.CPG

CPG File

Shapefile Code Page File
Ask a question
QUICK ANSWER

A CPG file is a one-line plain-text file that belongs to an Esri Shapefile. It declares the character encoding (for example UTF-8 or Windows-1252) used in the shapefile's .dbf attribute table. Open it in any text editor, or let QGIS and ArcGIS read it automatically when you load the shapefile.

Developer: Esri (shapefile ecosystem); used by ArcGIS, QGIS, GDAL Category: GIS Files Open standard MIME: text/plain
OPENS ON Windows macOS Linux
Related: .GPX · .GML · .KML · .SHP

On this page

19k+ extensions indexed
Last reviewed Jun 23, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

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: LOW

A .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
FULL NAMEShapefile Code Page File
DEVELOPEREsri (shapefile ecosystem); used by ArcGIS, QGIS, GDALsince with the Esri Shapefile sidecar set (1990s onward)
CATEGORYGIS Files
MIME TYPEtext/plain
TYPEPlain text (single code-page identifier)
STANDARDOpen · royalty-free
This extension is also used by…
  • 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

Windows3 apps
Notepad / any text editor Built-in Right-click → Open with → Notepad to read or change the encoding name (e.g. set it to UTF-8).
QGIS Open-source Add the companion .shp as a vector layer; QGIS reads the .cpg automatically to decode attribute text.
ArcGIS Pro Paid Open the shapefile; ArcGIS honours the .cpg for attribute encoding (or edit it in a text editor).
macOS1 app
TextEdit / QGIS Open-source Read/edit the .cpg in TextEdit (plain text mode), or let QGIS use it when loading the shapefile.
Linux1 app
Any text editor / GDAL Open-source cat/edit the .cpg; GDAL/OGR reads it when loading the .shp (ogrinfo).

Technical details

deep spec
Format typePlain text - single-line character encoding declaration, no binary structure
MIME typetext/plain
Typical file size3-20 bytes (holds only a short encoding name or Windows code-page number)
Binary signature / magic bytesNone - file has no header; content is a bare text string
Role in shapefile setDeclares 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 valuesNamed strings (UTF-8, ISO-8859-1, WINDOWS-1252) or Windows code-page numbers (65001, 1252, 1250, etc.)
Developer / ecosystemEsri shapefile convention; broadly supported by ArcGIS, QGIS, GDAL, MapInfo, and FME
Fallback without .cpgApplications default to system locale or Latin-1 encoding; behavior varies by tool and can cause diacritic corruption
Line structureSingle line, no key-value pairs, no delimiters - the entire file is one encoding identifier
Case sensitivityContent string handling is tool-dependent; most GIS tools accept both upper and lower case (e.g. utf-8 and UTF-8)
GDAL supportAutomatically read and written by GDAL's OGR Shapefile driver when loading or exporting shapefiles
EditabilityFully human-readable and editable in any plain-text editor (Notepad, Vim, VS Code, etc.)
Practical impact of omissionAbsence can cause mojibake, question marks, or garbled characters in attribute fields containing non-ASCII text
Releasedwith the Esri Shapefile sidecar set (1990s onward)
Open standardYes · royalty-free
Specificationdesktop.arcgis.com

CPG conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with CPG files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about CPG files.

Frequently asked questions

What is a .cpg file in a shapefile?
It is a one-line text file that tells GIS software which character encoding (e.g. UTF-8 or Windows-1252) the shapefile's .dbf attribute text uses, so names display correctly.
Can I delete the .cpg file?
Yes, the shapefile still opens, but the software then guesses the encoding from the .dbf header or system default - which can garble accented or non-Latin characters.
How do I fix garbled attribute text in QGIS/ArcGIS?
Create or edit the .cpg next to the .shp with the correct encoding name (often 'UTF-8') and reload the layer.
How do I open a .cpg file?
With any text editor (Notepad, TextEdit). It contains a single encoding name, nothing more.
Is .cpg a Manga Studio file?
Older Manga Studio used .cpg for comic pages, but today the common .cpg is the GIS shapefile code-page file. Check whether it sits next to a .shp (GIS) or opens in Clip Studio (art).

References

1Esri - Shapefile file extensionsdesktop.arcgis.com
2Esri KB - code pages in shapefiles/dBASEsupport.esri.com

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.PARTPartial Download File
4.DATProgram Data File (generic)
5.EXEWindows Executable (Portable Executable)
6.BINCD/DVD Disc Image (BIN/CUE)
7.NOMEDIAAndroid No-Media Marker File
8.RPMSGRestricted Permission Message
9.MDMarkdown Document
10.TMPTemporary File

Related extensions

.GPXGPS Exchange Format
.GMLGeography Markup Language
.KMLKeyhole Markup Language
.SHPEsri Shapefile (geospatial vector data)
.RTMAPCompeGPS / TwoNav Tiled Raster Map
.KMZKeyhole Markup Language Zipped (Google Earth)

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z