PNG File Header and Magic Bytes

A PNG datastream begins with a fixed eight-byte signature followed by length-prefixed chunks. The first chunk is IHDR and the final chunk is IEND.

PNG signature at offset 0

89 50 4E 47 0D 0A 1A 0A

The signature occupies offsets 0x00–0x07. It includes the ASCII letters PNG plus bytes chosen to expose common text-transfer and line-ending corruption.

IHDR header fields and offsets

The first chunk starts immediately after the signature. A conforming PNG uses a 13-byte IHDR data field.

OffsetLengthFieldInterpretation
0x084Chunk data lengthBig-endian; normally 13 for IHDR
0x0C4Chunk typeASCII IHDR (49 48 44 52)
0x104WidthUnsigned big-endian pixels; zero is invalid
0x144HeightUnsigned big-endian pixels; zero is invalid
0x181Bit depth1, 2, 4, 8, or 16 subject to color type
0x191Color typeGrayscale, truecolor, indexed, or alpha variants
0x1A1CompressionMethod 0
0x1B1FilterMethod 0
0x1C1Interlace0 for none, 1 for Adam7
0x1D4IHDR CRCCRC over chunk type and data

PNG chunk layout

Every chunk stores a four-byte big-endian data length, a four-byte ASCII type, the declared data bytes, and a four-byte CRC. Critical image data appears in one or more IDAT chunks; IEND terminates the datastream.

Chunk lengths vary, so only the signature and first IHDR locations are fixed. To navigate later chunks, read each length and advance by length + 12 bytes from the start of that chunk.

Practical PNG inspection checks

  • Confirm the full eight-byte signature, not only the letters PNG.
  • Check that IHDR is first and declares 13 data bytes.
  • Interpret width and height as unsigned big-endian integers.
  • Check that the bit-depth and color-type combination is permitted by the PNG specification.
  • Use a format-aware validator to verify every chunk length, ordering rule, and CRC.

Local processing and privacy

The PNG file format workflow opens the same Bitpeek browser workspace. Selected file bytes, file names, pasted input, searches, edits, hashes, and comparison data are processed in local browser memory and are not sent to a Bitpeek server.

The static guide itself can be read without opening a file or creating an account.

Technical reference: W3C PNG Specification, Third Edition.

Frequently asked questions

Are PNG integers little-endian?

No. PNG multi-byte integers, including chunk lengths, width, and height, use network byte order (big-endian).

Is IHDR always at offset 0x0C?

For a valid PNG datastream, yes. The eight-byte signature is followed by the first chunk length at 0x08 and the IHDR type at 0x0C.

Can Bitpeek validate a complete PNG?

Bitpeek can expose bytes, interpretations, CRC values for selections, and the leading signature. A dedicated PNG validator is still needed for full conformance.