A PNG file that throws libpng error: IDAT: CRC error has failed its internal checksum for the image data chunk. The library libpng, which powers decoding in nearly all viewers and browsers, calculated a CRC that did not match the one stored in the file. The viewer then refused to display the image. The damage is common, and you can often recover the picture.
How PNG Chunks and CRC Checksums Work
Chunk Structure and the CRC-32 Checksum
Every PNG file is built from chunks. Each chunk carries a 4-byte length field, a 4-byte type code such as IDAT or IHDR, the data payload, and a 4-byte CRC-32 checksum. The CRC is computed over the chunk type and the data. When libpng reads a chunk, it recalculates the CRC and compares it to the stored value. A mismatch triggers the error.
Because the CRC covers both the type and the data, a mismatch means something in that chunk has been altered or corrupted. The severity depends on which chunk failed.
IDAT Chunk CRC Errors
Why IDAT Failures Are the Most Common
The IDAT chunk holds the compressed pixel data. A CRC error here means the checksum for that particular IDAT chunk is wrong. IDAT chunks are large and vulnerable to damage during transfer or storage, so this is the error you will see most.
Viewer behaviour splits two ways. Some viewers ignore the CRC error and attempt to display the image anyway, showing a partial or distorted picture. Strict viewers, including most browsers and editors, stop decoding immediately and show only the error message.
What the Error Actually Means for Your Image
A CRC error on an IDAT chunk signals potential damage to the compressed pixel data. It does not mean all data is lost. The pixel data itself may still be intact if only the stored CRC value was corrupted. In other cases, the data is truly damaged. You cannot tell which from the error message alone.
IHDR and Other Chunk CRC Errors
Critical vs. Ancillary Chunk Failures
An IHDR: CRC error is more serious. The IHDR chunk holds the image dimensions and colour settings. If its CRC is wrong, libpng cannot trust the basic parameters of the image. The entire decode may fail or produce a garbled result.
CRC errors on ancillary chunks such as tEXt (text metadata) or gAMA (gamma) are less critical. The image data itself may still be valid. Most viewers skip the damaged ancillary chunk and continue loading the picture.
Distinguishing CRC Errors from Zlib Errors
Not every IDAT failure is a CRC error. Common zlib errors include incorrect header check and invalid distance too far back. These mean the compressed pixel data is damaged at a level below the chunk checksum. The CRC might have passed, but decompression still failed. Both errors mean the image is corrupted, but the root cause differs. A CRC error points to corruption in the chunk structure or data. A zlib error points to corruption inside the compressed stream.
How to Fix a PNG with a CRC Error
Decode, Recover, Rewrite
No fix is guaranteed because the original data is missing or changed. You can often recover a viewable image by using tools that ignore CRC errors and recalculate the checksums. The approach: decode as much of the file as possible, then write a fresh PNG.
- Open the corrupted PNG in a viewer that ignores CRC errors. Some image viewers and editors attempt to display the image despite the error.
- If the image displays, save a copy. The software writes a new PNG with correct CRC values for every chunk.
- If the image does not display, use a dedicated repair tool that extracts readable pixel data and outputs a valid PNG.
Writing a fresh PNG recalculates every checksum. The output file will carry correct CRCs for whatever data was recovered. If the pixel data was only partially damaged, you still get a usable image.
Using Png.repair for CRC Errors
Png.repair recovers corrupted PNG files online, free and without watermarks. Upload the damaged file. The tool reads as much pixel data as it can and produces a valid PNG that opens in any viewer. It is faster than manually editing chunk checksums.
Preventing CRC Errors in PNG Files
Stop Corruption Before It Happens
CRC errors come from file corruption during transfer or storage. Reduce the risk:
- Use checksumming transfer protocols such as SFTP or HTTPS.
- Keep backups. Do not rely on a single copy of any PNG.
- After downloading or copying a PNG, open it in a viewer that checks CRCs to confirm the file arrived intact.