A file that will not open is not always corrupted. Sometimes you just need the right program. Use these checks to find out for sure.
Step 1: Rule out simple problems
- Is the extension right? A .docx renamed to .pdf will not open.
- Do you have a program that supports the format?
- Is the file zero bytes or unusually small?
- Does it open on another computer?
Step 2: Check the file type
On Mac and Linux, the file command reads the actual header:
file document.pdf
If it says "data" instead of "PDF document", the header is probably damaged.
Step 3: Use format-specific checkers
| Format | Command or method |
|---|---|
| ZIP, DOCX, XLSX | unzip -t file.zip tests the archive |
qpdf --check file.pdf or pdfinfo file.pdf |
|
| PNG | pngcheck image.png |
| JPEG | jpeginfo -c image.jpg |
| Video and audio | ffprobe file.mp4 or ffmpeg -v error -i file.mp4 -f null - |
These tools report errors if the structure is damaged.
Step 4: Verify with a checksum
If you have a checksum from the source, compare it to your file.
- Windows:
certutil -hashfile file SHA256 - Mac:
shasum -a 256 file - Linux:
sha256sum file
A mismatch means the file differs from the original.
Step 5: Try opening in more than one program
Some programs are strict, others forgiving. If a file opens in one tool but not another, the damage may be minor.
Step 6: Check your disk
If many files are damaged, check your drive for errors. See what corrupts a file.
What next?
If the file is truly damaged, follow our recovery guide. If the download was the problem, see incomplete or corrupted downloads.
For testers: build your own samples
If you are building or testing a file checker, you need files with known damage. Create them with CorruptAnyFile and check that your checker flags them. You can also read how to corrupt a file and what a corrupt file is.
FAQ
How can I check if a file is corrupted? Try opening it, check its type and test it with a format-specific tool.
Is there a free corrupt file checker? Yes. Tools like unzip -t, qpdf, pngcheck and ffprobe are free.
Does a file that will not open mean it is corrupted? Not always. The extension or the program may be the problem.