PNG Chunk Inspector

Every chunk in a PNG, with its checksum verified.

  • Runs on your device
  • CRC verified
  • Metadata surfaced
A round terracotta clay board on a pale wooden table, with a chain of soft clay links laid across it and a small round clay ring like a magnifier sitting over the middle link.

The guide

A PNG is a list of labelled boxes, and every box has its own checksum

Open a PNG as chunks and you see what the picture is made of, which boxes can be damaged without notice, and which can quietly carry text, times and camera details.

  • 67 bytes the smallest example the tool builds: a 1 by 1 grey image
  • 89 50 4E 47 0D 0A 1A 0A the eight-byte signature every PNG starts with
  • 3A7E9B55 CRC of the example's header chunk, type letters included
  • AE426082 CRC of the four letters IEND, which have no data to add
  • 2,147,483,647 the largest data length a chunk may state
Read the full guide Fold the guide 7 min · 12 sources

To a person, a PNG is a picture. To a program it is a short signature followed by a list of labelled boxes. Each box is called a chunk, and each one ends with a checksum. Open the file as chunks and you can see what the picture is made of, and what else travelled with it.

The first eight bytes never change: 89 50 4E 47 0D 0A 1A 0A. Wikipedia gives a reason for each. The first byte has its high bit set, which catches systems that cannot carry 8-bit data and makes it unlikely that a text file passes as a PNG. The next three are the letters PNG. Then come a DOS-style line ending, a byte that stopped display under the old DOS type command, and a Unix-style line ending. A file mangled by a line-ending conversion no longer matches.

The W3C specification adds the promise behind those bytes. They say the rest of the datastream is a single image, built from chunks that begin with IHDR and end with IEND. A file that does not start with them is not a PNG datastream, whatever its name claims.

What a PNG file is made of

Every chunk has four fields. First a length of four bytes, which counts only the data field and never itself, the type or the checksum. Then a type of four bytes. Then the data, which may be empty, and finally a CRC of four bytes. A length of zero is valid. The specification caps the length at 2,147,483,647, because every PNG integer is limited to 2 to the 31 minus 1 so that languages without an unsigned four-byte type can still read it.

Take the smallest example the tool builds, a 1 by 1 grey image. It is 67 bytes: 8 for the signature, 25 for the header chunk, 22 for one image-data chunk and 12 for the end chunk. Add them and you get the file size, which is the first sanity check any chunk list should pass.

The header chunk is 25 bytes because its data is 13. Width and height take four bytes each, then one byte each for bit depth, colour type, compression, filter and interlace. Here the width is 1, the height is 1, the depth is 8, and the colour type is 0, which means greyscale. The image-data chunk holds a 10-byte compressed stream that expands to a filter byte and one grey sample. The end chunk holds nothing, so it is only a length, a type and a CRC.

Type names are four letters, and the case of each letter is a code. Bit 5 of each byte, the value 32, is a property bit. An uppercase first letter marks a critical chunk, needed to show the image. A lowercase second letter marks a private chunk, which the specification does not define. The third letter has to be uppercase. A lowercase last letter says an editor may safely copy the chunk. So IHDR, IDAT and IEND are critical, and tEXt and pHYs are ancillary.

A decoder that meets an unknown ancillary chunk can skip it. One that meets an unknown critical chunk has to tell the user that the image holds information it cannot safely interpret. Wikipedia describes this layout as designed to let the format be extended while keeping compatibility with older versions. The case rule is how an old reader knows what it may ignore.

Why every chunk carries a checksum

The CRC covers the type and the data, and leaves out the length. The specification says it uses the same polynomial as the gzip format, starts from all ones, processes each byte from its least significant bit, inverts the result at the end and stores it most significant byte first. Wikipedia describes a cyclic redundancy check as an error-detecting code for accidental changes: a short check value is attached to the data and recomputed when the data is read back.

It is well suited to one kind of damage in particular. Wikipedia explains that cyclic codes are good at spotting burst errors, runs of wrong bits in a row, which are common on storage devices and noisy links. A check on each chunk also tells you where the damage is. Instead of a file that will not open, you get one named chunk at one offset.

In the 67-byte example the header’s CRC is 3A7E9B55. It is computed over the four letters IHDR and the 13 data bytes, 17 bytes in all, and not over the length. The end chunk has no data, so its CRC covers only the four letters IEND. That gives AE426082, the same value in any PNG, because nothing else goes into it.

Change one bit in a width and only that header’s checksum fails. The tool’s flipped-bit example does exactly this: the width of 24 becomes 28, and the list flags IHDR and nothing else. The checksum has done its job.

A CRC is not a seal. Wikipedia is blunt about this: CRCs are designed for accidental errors and are not suitable against intentional alteration. Anyone who edits a chunk can recompute its CRC, because there is no secret in it. A matching checksum means the bytes are the ones the writer’s checksum covered. It says nothing about who wrote them, or whether they are true.

What the chunks can say about you

Three chunk types carry text. A tEXt chunk holds a keyword of 1 to 79 bytes, a zero byte and the text, read as Latin-1, which Wikipedia describes as an 8-bit encoding of 191 Latin-script characters. A zTXt chunk is the same with the text compressed as a zlib stream, which RFC 1950 describes as a header, deflate data and an Adler-32 check. An iTXt chunk holds UTF-8, defined in RFC 3629, with an optional compression flag and a language tag.

The specification predefines keywords such as Title, Author, Description, Copyright, Creation Time, Software, Disclaimer, Warning, Source and Comment. Source is the device used to make the image. Any program may also define its own keywords, so a text chunk can hold anything, including a block of descriptive XML. Compression hides it from a plain text search of the file.

Two small chunks carry numbers. The pHYs chunk gives pixels per unit, and the unit is the metre or unknown. One inch is exactly 0.0254 metre, so 2,835 pixels per metre is about 72 dots per inch. The tIME chunk stores the last time the image was changed, not the time it was made, and the specification asks for UTC. Neither names a person, but a time stamp can place a file on a day.

The eXIf chunk holds an Exif profile. Wikipedia lists what Exif can record: camera make and model, settings, the date and time, a thumbnail and, when the device has a receiver, a location. It also warns that editing software sometimes fails to update the thumbnail. The PNG specification advises treating an Exif block as of historical value only, unless the decoder knows it is still valid, because the image may have been edited since.

Then there are chunks nobody documents. A lowercase second letter marks a private chunk whose meaning is set by the program that wrote it. The tool lists these as unknown and shows their first bytes.

What a clean structure does not prove

Passing every check proves that the boxes are intact, not that the picture will appear. A walk over lengths, types and checksums does not decompress the image data. The compressed pixel stream has its own Adler-32 check inside the zlib format, and a header can name an allowed combination of colour type and bit depth while the stream behind it is damaged. That is why the tool also asks the browser’s own decoder for a small preview and says plainly when it fails.

The rules a decoder relies on are short. IHDR comes first and holds 13 bytes. A valid datastream has one or more IDAT chunks, and they must sit next to each other. IEND comes last. Because IEND marks the end of the datastream, bytes after it never reach the picture, but they can still be there, and the chunk list shows them.

The tool reads the file in slices with Blob.slice, which MDN describes as returning a new Blob holding a subset of the original. The work runs in a Web Worker, so the page stays responsive. Compressed text is expanded with the browser’s DecompressionStream, which MDN notes is available in workers, and UTF-8 text is decoded with TextDecoder. Expansion is cut at 1 MiB per chunk, and a text value is shown to 64 KiB.

Treat everything the tool shows in its metadata panel as a claim by whatever wrote the file. Text can be false, a time can be edited, and an Exif block can describe a photo that was later changed. A viewer should not trust it because it came with a valid checksum. The tool only shows what is there. Making a stripped copy is a different job.

Sources

Every source consulted for this guide. Links checked November 9, 2026.

  1. Portable Network Graphics (PNG) Specification (Third Edition) World Wide Web Consortium
  2. PNG - Wikipedia Wikipedia
  3. Cyclic redundancy check - Wikipedia Wikipedia
  4. Exif - Wikipedia Wikipedia
  5. ISO/IEC 8859-1 - Wikipedia Wikipedia
  6. RFC 1950: ZLIB Compressed Data Format Specification version 3.3 RFC Editor (IETF)
  7. RFC 1952: GZIP file format specification version 4.3 RFC Editor (IETF)
  8. RFC 3629: UTF-8, a transformation format of ISO 10646 RFC Editor (IETF)
  9. Blob: slice() method MDN Web Docs
  10. TextDecoder MDN Web Docs
  11. Web Workers API MDN Web Docs
  12. DecompressionStream MDN Web Docs