A PNG is a signature followed by a list of chunks. Each chunk declares its own length and ends with a checksum over its type and data. Nothing in the file points at a chunk by offset, so removing one is a matter of not copying it — no rebuild, no index to fix.
That design is why a PNG can be cleaned without touching the image. The compressed pixel stream sits in its own chunks and is never read, let alone re-encoded.
The anatomy of a PNG chunk
The file begins with an eight-byte signature: 89 50 4E 47 0D 0A 1A 0A. After
that, every chunk has the same four fields: a four-byte big-endian length counting only the
data, a four-byte type, the data itself, and a four-byte CRC-32 computed over the type and
data. The CRC does not cover the length field.
The type is four ASCII letters, and the case of the first one carries meaning. An uppercase first letter marks a critical chunk: a decoder that does not understand it must stop. A lowercase first letter marks an ancillary chunk, which a decoder may skip. Every metadata chunk in the format is ancillary, which is exactly why they can be removed without breaking the image.
Order is constrained but simple. IHDR must come first, IEND must
come last, and the IDAT chunks must be consecutive. Anything else can be
reordered or dropped by a writer as long as it respects a few dependencies.
The chunks that carry metadata
Text arrives in three flavours, all with a keyword of up to 79 bytes. The differences are encoding and compression, and older files mix all three.
| Chunk | What it holds | Privacy relevance |
|---|---|---|
eXIf | A TIFF-style EXIF block, same structure as a JPEG APP1 without the header | GPS, device model, serials, timestamps, orientation |
tEXt | Latin-1 keyword and value, uncompressed | Author, title, software name, comments |
zTXt | Keyword plus zlib-compressed text | The same data, compressed, often device profiles |
iTXt | UTF-8 text with optional language tag and translated keyword | XMP packets, comments, captions |
tIME | Last modification time, seven bytes | When the file was edited |
iCCP | Profile name plus a zlib-compressed ICC profile | Colour space, not identity |
sRGB, gAMA, cHRM | Colour space signalling without a full profile | None |
pHYs | Physical pixel dimensions, the DPI value | None, though it hints at a device class |
IDAT | The zlib-compressed, filtered image data | The pixels themselves |
eXIf was added to the PNG specification in 2017, so older writers stored camera
data differently. ImageMagick, for example, has long written EXIF and IPTC as
tEXt or zTXt chunks with keywords such as
Raw profile type exif, holding the block as hex text. Adobe tools write XMP
into an iTXt chunk keyed XML:com.adobe.xmp.
A file can therefore carry metadata in several places at once, and removing only
eXIf can leave a complete copy behind in a text chunk.
IDAT is never touched
IDAT contains a zlib stream of filtered scanlines. Each row starts with a
filter byte selecting one of five predictors, then the filtered bytes. The stream can span
many chunks, and the chunk boundaries have nothing to do with row boundaries.
A chunk-level strip copies those chunks byte for byte. It does not inflate the zlib stream, does not reverse the filters and does not recompress anything, so the decoded pixels are identical by construction.
Re-saving in an editor is different, even though PNG is lossless. The editor decodes,
re-filters and re-deflates, producing different bytes and often a different file size. Pixel
values usually survive, but the file is not the same file, and many editors append their own
tEXt entry naming the software — so the save that removes metadata also adds
some.
Why screenshots carry text
A screenshot has no camera and normally no GPS, which makes it feel harmless. It often carries more text than a photo does: the application that captured it, the OS version, a creation timestamp, and sometimes the document or window it came from.
Capture tools on Windows and macOS commonly write a Software entry or a
tIME chunk, and the exact keys change between versions. Design tools go
further: an exported PNG can include an XMP packet with a document ID, the author name from
the licence, and a full edit history.
Because these are text chunks rather than a binary EXIF block, they are easy to miss. A tag
viewer that only parses eXIf will report a screenshot as clean while the
tEXt chunks still name the machine and the person who took it.
Chunks worth keeping
Keep iCCP. Wide-gamut exports, particularly Display P3 screenshots from macOS,
look wrong without their profile because viewers fall back to sRGB and the colours shift.
Keep sRGB, gAMA and cHRM if there is no
iCCP; the specification says a file should not carry both an embedded profile
and an sRGB chunk.
Keep eXIf only if it holds orientation you need. PNG viewers vary in whether
they honour it, so the safest approach for a rotated image is to rotate the pixels once in a
lossless editor and store the result upright, rather than relying on the tag.
pHYs is not personal. It records how many pixels make a metre, which affects
print size, so leave it alone unless you have a reason.
Stripping PNG metadata safely
Keep IHDR, PLTE, tRNS, IDAT and
IEND, plus the colour chunks. Drop the text chunks, eXIf,
tIME and any unknown ancillary chunk you did not ask for. Because whole chunks
are removed, no length or offset outside them needs updating.
If you trim eXIf down to a single orientation entry rather than dropping it,
you are editing a chunk: the length field and the CRC both have to be recomputed, and the
TIFF block inside must stay internally consistent. That is the one case where a PNG strip
involves real work.
To see which chunks a specific file actually has, open it in the chunk-aware remover, or read the WebP walkthrough for the equivalent structure in a RIFF container. The guide to profiles and orientation explains why two of these chunks are deliberately preserved.
See what your photos are carrying
Drop an image in. MetaPurge lists every tag, then rewrites the file without touching a pixel.
Open the metadata removerWhere to go next
- Removing metadata from WebP — the same idea with a file-level size field to fix.
- Removing metadata from JPEG — segments, scans and generation loss.
- What is EXIF metadata? — the tags inside an eXIf chunk.