CPG to TXT Converter

Convert Code page files (CPG) to TXT online for free

Secure Private 2,000+ daily conversions Free

Drop or upload your .CPG file

How to convert your CPG file to TXT

  1. Click the "Select File" button above, and choose your CPG file.
  2. You'll see a preview.
  3. Click the "Convert file to..." button and download the TXT file.

High Quality Conversion

Our advanced conversion technology delivers accurate CPG conversions while preserving quality and integrity of your Code pages.

Secure and Private

Your data is protected by strict privacy policies and access controls. Uploaded CPG Code pages and converted TXTs are deleted immediately after conversion.

Easy to Use

Upload your CPG file to preview it in your browser and download it as a TXT. No registration, watermarks, or software installation required.

CPG to TXT Conversion Explained

Converting .CPG (Code page files) to .TXT (Plain text files) is the process of changing the file extension to make its contents universally accessible to standard text editors. A .CPG file is already a plain text file. It contains a short text string—such as UTF-8, ISO-8859-1, or 1252—that tells Geographic Information System (GIS) software how to read the character encoding of an associated .DBF database file within an Esri Shapefile dataset.

People convert .CPG to .TXT to quickly read the encoding string without triggering an "Open With" dialog on their operating system, or to process the encoding data using generic text-parsing scripts. You gain immediate readability and universal compatibility. However, you lose the file's functional association with the Shapefile. If you rename the file instead of copying it, GIS software will no longer automatically detect the database encoding, which often results in garbled text (mojibake) in map attributes.

Typical Tasks and Users

  • GIS Administrators: Auditing legacy Shapefiles to verify character encodings before migrating data into modern spatial databases like PostGIS.
  • Data Engineers: Writing automated scripts that require standard .TXT inputs to log and standardize database encodings across large geospatial datasets.
  • General Users: Troubleshooting corrupted text in mapping software by extracting the code page string to share with technical support.

Software & Tool Support

Because .CPG files contain unformatted text, they do not require specialized conversion software. You can open, edit, and convert them using basic text editors and command-line tools.

  • Text Editors: Notepad++ or Microsoft Notepad on Windows, and Apple TextEdit on macOS can open .CPG files if you drag and drop them into the application. You can then use "Save As" to create a .TXT file.
  • Command-Line Tools: You can convert the file by renaming it using ren file.cpg file.txt in Windows Command Prompt, or mv file.cpg file.txt in Linux/macOS terminal.
  • GIS Software: Applications like QGIS and Esri ArcGIS Pro read .CPG files natively to render maps, but they do not offer a built-in export tool specifically to convert the .CPG file to .TXT.

Pros and Cons of the Conversion

Pros:

  • Universal Compatibility: A .TXT file opens instantly on any operating system when double-clicked.
  • Script Ingestion: Many basic data-processing scripts filter for .TXT extensions by default.
  • Safe Sharing: Sending a .TXT file bypasses email security filters that sometimes block uncommon extensions like .CPG.

Cons:

  • Breaks Shapefile Structure: A Shapefile requires the .CPG file to share the exact same base name as the .SHP and .DBF files, including the extension. Converting the original file breaks this link.
  • Redundancy: Since the file is already plain text, creating a separate .TXT file duplicates data unnecessarily unless required for a specific workflow.

Conversion Difficulties & Why Convert.Guru

The technical pipeline to convert .CPG to .TXT is simple, but practical difficulties arise during batch processing. When dealing with hundreds of Shapefile directories, manually renaming or opening each file is inefficient. Additionally, some legacy .CPG files contain hidden Byte Order Marks (BOM) or trailing whitespace that can break strict text-parsing scripts if not cleaned during conversion.

Convert.Guru handles this conversion accurately by safely extracting the code page identifier and generating a clean, standardized .TXT file. It strips unnecessary hidden characters and ensures the output is strictly formatted. Using Convert.Guru also prevents accidental modification or deletion of your original .CPG file, keeping your GIS dataset intact while giving you the text file you need.

CPG vs. TXT: What is the better choice?

Feature CPG TXT
Primary Use Defining character encoding for GIS databases Storing generic, unformatted text
Format Type Plain text Plain text
Software Association Esri Shapefile datasets Universal (Notepad, TextEdit, etc.)

Which format should you choose?

Choose .CPG if you are actively using the file as part of a spatial dataset. The GIS software requires this exact extension to read the attribute table correctly.

Choose .TXT if you are documenting dataset metadata, auditing encodings across a server, or sharing the encoding string with a user who does not have GIS software installed. If you must convert .CPG to .TXT, always create a copy of the file rather than converting the original, so you do not corrupt your Shapefile.

Conclusion

Converting .CPG to .TXT makes sense when you need to audit, document, or script the extraction of character encoding data from legacy GIS files. The biggest limitation to watch for is breaking the Shapefile structure; removing the .CPG extension from a working dataset will cause mapping software to fall back to system default encodings, often ruining text attributes. Convert.Guru provides a reliable, safe way to convert .CPG to .TXT, ensuring you get a clean text file for your documentation workflows without risking damage to your original spatial data.


FAQ

Convert.Guru also easily converts CPG Code pages (Shapefile Encoding Text File) to various formats - free and online. No Excel or extra software needed.

Convert the CPG locally and export to TXT using Excel software or a reliable desktop converter — no internet needed. The easiest way is to open the CPG file in the software on your computer and then save it as a TXT file in the File menu under Save as...



About the CPG to TXT Converter

Convert.Guru makes it fast and easy to convert Code page files to TXT online. The CPG to TXT converter runs entirely in your browser, so there’s no software to install and no account required. Powered by one of the industry’s largest and most trusted file format databases—maintained for more than 25 years—our technology reliably identifies CPG Code pages even when they are damaged or incorrectly named. Uploaded files are automatically deleted after conversion to protect your privacy.