Use the free command-line utility pngcheck to test PNG files for corruption. It tells you whether a file is valid or which chunk contains an error. The tool prints a one-line summary for each file. With the verbose flag, it lists every chunk and its length. If a chunk fails its checksum, pngcheck reports the CRC error and names the chunk. You can check a single file or a whole folder at once.
What Pngcheck Does
pngcheck is a free command-line tool that tests PNG files for corruption. It checks the file signature, the sequence of chunks, and the checksums (CRC values) inside each chunk. A file that passes has a valid signature, correct chunk order, and correct checksums. Only files that fail need repair. The tool does not fix files. It only reports problems.
The basic command is pngcheck file.png. This prints a one-line summary: either OK or an error message. For more detail, use pngcheck -v file.png (verbose mode). Verbose mode lists every chunk in the file with its type and length so you can see exactly where a problem occurs.
Installing Pngcheck
pngcheck runs on most operating systems.
macOS
Install it with Homebrew. Run this in a terminal:
brew install pngcheckLinux
Use the system package manager. On Debian or Ubuntu:
apt install pngcheckWindows
Download a precompiled binary from the official pngcheck website and place it in a folder that is in your system PATH.
Check a Single PNG File
Basic Check
Open a terminal and type:
pngcheck picture.pngIf the file is valid, you will see output like:
OK: picture.png (24-bit RGB, non-interlaced)If the file has a problem, pngcheck prints an error message that tells you which chunk is damaged and whether it is a CRC error or another type of problem.
Verbose Check
For a detailed view of every chunk, use the -v flag:
pngcheck -v picture.pngThis lists each chunk type (IHDR, IDAT, IEND) along with its byte length. If a chunk has a CRC error, the line shows CRC error next to that chunk. You see exactly which chunk is corrupted before you attempt a repair.
Check Multiple Files at Once
Check all PNG files in a folder with a wildcard pattern:
pngcheck *.pngpngcheck processes each file in order and prints a one-line result for each. Use this when you have a large collection of images and need to find corrupted PNG files fast. The output shows which files pass and which fail, along with the error for each failing file.
Combine the wildcard with the verbose flag to see detailed chunk information for every file:
pngcheck -v *.pngVerbose output for many files runs long. Redirect it to a text file for easier review:
pngcheck -v *.png > check_results.txt
Understanding CRC Errors
A CRC error (Cyclic Redundancy Check error) means the checksum stored inside a chunk does not match the checksum calculated from the chunk data. The chunk data has been altered or corrupted. pngcheck reports a pngcheck crc error and names the chunk that failed. For example:
ERROR: picture.png: IDAT: CRC errorThis tells you the IDAT chunk, which holds the compressed image data, has a checksum mismatch. Knowing which chunk is damaged helps you decide whether the file can be repaired. A CRC error in the IHDR chunk (header) may be fixable by recalculating the CRC. A CRC error in IDAT may require image recovery tools.
How to Use the Results
- Files that pass: No action needed. They are valid PNG files.
- Files with CRC errors: These files need repair. The chunk name tells you where the problem is. If the error is in a critical chunk like IHDR or IDAT, the image may still be viewable but with visual artifacts. Use a repair tool (such as the online service at png.repair) to fix the corrupted file.
- Files with other errors: pngcheck may report a bad signature, a truncated file, or invalid chunk order. These files are also candidates for repair.
Always run pngcheck before sending a file for repair. It gives you a clear diagnosis and saves time if the file is actually valid.
Checking a Folder Recursively
If your PNG files are stored in subfolders, check them all with a recursive command. On Unix-like systems (macOS, Linux), combine find with pngcheck:
find . -name "*.png" -exec pngcheck {} \;This finds every PNG file in the current directory and all subdirectories, then runs pngcheck on each one. For verbose output:
find . -name "*.png" -exec pngcheck -v {} \;On Windows, use a similar approach with PowerShell or a batch script. A recursive check is the most thorough way to find corrupted PNG files across a large collection.