What is the CPG file format?
A .cpg file is a plain-text sidecar file in the Esri Shapefile dataset. It contains a single line that names the character encoding - such as UTF-8, ISO-8859-1, 1252, or 65001 - used for text stored in the companion .dbf attribute table.
Without a .cpg file, GIS software must guess the encoding of the .dbf table, which can result in garbled text, mojibake, or missing diacritics in place names and attribute fields. Including a .cpg file eliminates that ambiguity and ensures consistent text display across platforms and locales.
The file shares its base name with the other shapefile components: geometry in .shp, the spatial index in .shx, attributes in .dbf, and the coordinate reference system in .prj. Together they form the complete shapefile dataset. The .cpg component holds nothing but a short text string - no binary header, no key-value structure - so any text editor can read or correct it.
Major GIS platforms read .cpg automatically when loading a shapefile and write one when exporting with an explicit encoding. This includes QGIS, ArcGIS Pro, and GDAL-based tools. The file was introduced as part of Esri's shapefile sidecar convention in the 1990s and remains in active use wherever shapefiles are exchanged.
Security & safety
RISK: LOWA .cpg is a tiny plain-text file containing only an encoding name - no executable content, negligible risk. The only practical concern is data correctness: deleting or setting the wrong code page garbles attribute text. Edit with a plain-text editor, never a word processor that adds formatting.
Format details
in a nutshell- Manga Studio / Clip Studio page file - Legacy Manga Studio (Smith Micro, now Clip Studio Paint by Celsys) used .cpg as a comic page/canvas file - a different format the database's old name 'Manga Studio drawing' described.
- CopyMinder protected-program file - Some software protected with the CopyMinder DRM system stores licensing data in a .cpg file.
Programs that open CPG files
Technical details
deep spec| Format type | Plain text - single-line character encoding declaration, no binary structure |
| MIME type | text/plain |
| Typical file size | 3-20 bytes (holds only a short encoding name or Windows code-page number) |
| Binary signature / magic bytes | None - file has no header; content is a bare text string |
| Role in shapefile set | Declares the character encoding for attribute text stored in the companion .dbf table |
| Companion files required | .shp, .dbf, .shx - all sharing the same base name as the .cpg file |
| Supported encoding values | Named strings (UTF-8, ISO-8859-1, WINDOWS-1252) or Windows code-page numbers (65001, 1252, 1250, etc.) |
| Developer / ecosystem | Esri shapefile convention; broadly supported by ArcGIS, QGIS, GDAL, MapInfo, and FME |
| Fallback without .cpg | Applications default to system locale or Latin-1 encoding; behavior varies by tool and can cause diacritic corruption |
| Line structure | Single line, no key-value pairs, no delimiters - the entire file is one encoding identifier |
| Case sensitivity | Content string handling is tool-dependent; most GIS tools accept both upper and lower case (e.g. utf-8 and UTF-8) |
| GDAL support | Automatically read and written by GDAL's OGR Shapefile driver when loading or exporting shapefiles |
| Editability | Fully human-readable and editable in any plain-text editor (Notepad, Vim, VS Code, etc.) |
| Practical impact of omission | Absence can cause mojibake, question marks, or garbled characters in attribute fields containing non-ASCII text |
| Released | with the Esri Shapefile sidecar set (1990s onward) |
| Open standard | Yes · royalty-free |
| Specification | desktop.arcgis.com |
CPG conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about CPG files.