What is the CPGZ file format?
The .cpgz extension marks a compressed CPIO (Copy In, Copy Out) file archive that uses the Gzip compression algorithm as its outer layer. CPGZ format doesn't impose any restriction on the type of data stored - it may hold application files, installers, documents, or photos. Creating a .cpgz involves two sequential stages:
- Creation of an uncompressed CPIO archive - produces a single stream of files and directories, each preceded by a header section containing file metadata.
- Compression using GZIP - a lossless method based on the DEFLATE algorithm, which reduces the archive's overall size.
Since Gzip-compressed files normally carry the .gz suffix, the combined .cpgz extension follows the same two-part naming convention as .tgz (a Gzip-compressed TAR archive). A .cpgz file begins with the standard gzip magic bytes 1F 8B 08 at offset 0; after decompression, the inner stream is a CPIO archive, most commonly in SVR4 newc format (magic 070701).
The format is most closely associated with macOS, where the ditto command-line tool and Archive Utility can both create and extract .cpgz files. On Linux and Unix, the equivalent pipeline is gunzip piped into cpio, or a single call using bsdtar.
A common real-world scenario is a .cpgz appearing unexpectedly as a failure artifact: when macOS Archive Utility cannot fully extract a downloaded .zip - because the file is truncated, corrupted, or structured in a way the utility mishandles - it may re-compress the partial result into a .cpgz. Repeatedly double-clicking the file then creates a loop: each attempt alternates between a .zip and a .cpgz without ever extracting the contents. The solution is to reacquire the original archive, or use a third-party tool such as The Unarchiver or Keka.
CPIO itself dates from the 1970s Unix era, when magnetic tapes were the primary archiving medium. Different CPIO variants store file headers in binary or ASCII text format, and maximum per-file sizes range from 2 GB in older binary variants to 4 GB in SVR4 newc. The .cpgz pairing is not a formal standard but a practical convention popularized by macOS tooling.
Security & safety
RISK: LOWThe format itself is safe - it's just compressed archive data that can't run on its own. Normal archive caution applies: a .cpgz from an untrusted source can contain executables or scripts revealed only after extraction, so scan contents before running anything, and extract untrusted archives into an empty folder (cpio can store absolute or '../' paths, a path-traversal risk). The most common 'problem' with .cpgz isn't malware but corruption: an unexpected .cpgz from a download usually means the .zip arrived broken - re-download rather than fighting it.
Format details
in a nutshellPrograms that open CPGZ files
cpio -idmv). Pre-installed on most systems. Technical details
deep spec| MIME type | application/gzip (primary); also application/x-cpio and application/octet-stream |
| Magic bytes | 1F 8B 08 at offset 0 (gzip outer layer); inner cpio stream opens with 070701 (SVR4 newc) after decompression |
| Outer compression | DEFLATE algorithm wrapped in gzip framing (RFC 1952) |
| Inner archive format | CPIO - most commonly SVR4 newc (magic 070701); also portable ASCII (magic 070707) |
| File encoding | Binary outer stream; cpio newc entry headers use fixed-width ASCII-hex fields, making them endian-independent |
| Integrity checks | gzip footer stores CRC-32 and 4-byte ISIZE (uncompressed size mod 2³²); cpio 'crc' variant adds per-file CRC-32 checksums |
| Encryption | None - neither gzip nor cpio provides a built-in encryption layer; files must be encrypted separately if confidentiality is required |
| Max file size per entry | ~4 GB in SVR4 newc (32-bit filesize field); older binary cpio format limited to ~2 GB |
| Archive structure | Linear sequential stream with no central directory; all entries must be read from the start of the stream |
| cpio entry header (newc) | 110-byte fixed-length ASCII header per entry, followed by the null-terminated filename and file data padded to 4-byte boundaries |
| Associated platforms | macOS (primary); Linux; Unix |
| Primary creation tool (macOS) | ditto command-line utility; Archive Utility also produces .cpgz as a failure artifact when a .zip cannot be fully extracted |
| Maximum entry count | No fixed limit; cpio streams entries sequentially without a central-directory record cap |
| Streaming extraction | Yes - sequential design enables pipe-based extraction (e.g., gunzip -c file.cpgz | cpio -idmv) without loading a directory into memory |
| Released | cpio: 1970s Unix; gzip: 1992. The .cpgz pairing is a macOS convention. |
| Latest version | N/A (relies on stable gzip RFC 1952 + POSIX cpio formats) |
| Open standard | Yes · royalty-free |
| Specification | www.rfc-editor.org |
CPGZ conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about CPGZ files.
Frequently asked questions
What is a CPGZ file?
Why did my ZIP turn into a CPGZ on my Mac?
My .zip and .cpgz keep switching back and forth - how do I fix it?
How do I open a CPGZ file?
ditto -x -k file.cpgz dest. On Linux: gunzip -c file.cpgz | cpio -idv. On Windows use free 7-Zip or PeaZip.