How to Repair a Corrupted PDF
Fix corrupted PDF files that won't open. Free methods using online tools, Ghostscript, QPDF, and prevention tips to protect your documents.
You try to open a PDF and nothing happens. Or you get an error message: "The file is damaged and could not be repaired." Or it opens but pages are missing, images are garbled, or text is scrambled. PDF corruption is frustrating, but in many cases the file is recoverable.
This guide covers why PDFs corrupt, how to recognize the symptoms, and the free tools you can use to repair them — both online and offline.
Why Do PDFs Get Corrupted?
PDF corruption happens more often than most people realize. The common causes:
- Incomplete downloads: The most common cause. If your internet connection drops during a download, the PDF file is truncated — missing its final section and structural references.
- Interrupted file transfers: Copying a PDF to a USB drive or network share that gets disconnected mid-transfer produces a corrupt file.
- Crashes during save: If the application crashes while writing a PDF, the file structure may be incomplete or inconsistent.
- Disk errors: Bad sectors on a hard drive can corrupt any file, including PDFs.
- Email encoding issues: PDFs sent via email sometimes get corrupted by encoding mismatches between email servers.
- Virus or malware damage: Malicious software can deliberately corrupt or modify file structures.
- Improper merging or editing: Using poorly coded tools to merge, split, or edit PDFs can introduce structural errors.
Signs of PDF Corruption
Corruption manifests in several ways. Here is what to look for:
- File will not open at all: Your PDF reader shows an error or crashes when trying to open the file.
- Missing pages: The file opens but pages are missing or appear blank.
- Garbled text or images: Content is scrambled, overlapping, or displaying as random characters.
- Wrong page count: The reader shows a different number of pages than expected.
- Slow or freezing performance: The PDF opens but causes your reader to freeze or lag excessively.
- Error messages: Specific errors like "Invalid PDF structure," "Cross-reference table damaged," or "Unexpected end of file."
Method 1: Try a Different PDF Reader
Before diving into repair tools, try opening the file in a different PDF reader. Some readers are more tolerant of errors than others:
- SumatraPDF (Windows): Lightweight and handles damaged PDFs better than most readers. Often opens files that Adobe Reader refuses.
- Firefox or Chrome: Built-in PDF viewers in web browsers are surprisingly good at opening damaged PDFs. Try dragging the file into a browser window.
- Evince (Linux): The default document viewer on many Linux distributions. Tolerates many types of corruption.
- Mac Preview: Sometimes opens files that other readers cannot, especially on macOS.
If the file opens in one reader but not another, the PDF is partially damaged but likely recoverable. The reader that opened it may have silently skipped or repaired the damaged sections.
Method 2: Free Online PDF Repair Tools
Several online tools can repair corrupted PDFs for free:
PDF24 Tools
PDF24 offers a free PDF repair tool. Upload your corrupted file, and the tool attempts to rebuild the PDF structure. It can fix cross-reference table errors, repair damaged headers, and recover missing page trees. Completely free with no file size limits.
iLovePDF Repair
Upload your damaged PDF and iLovePDF attempts to fix it. The tool rebuilds the file structure and recovers readable content. Free for files up to 100MB. Works well for mildly corrupted files.
Sejda PDF Repair
Sejda offers a repair function that can fix common PDF errors. Upload your file, and Sejda analyzes the structure and attempts recovery. Free for documents up to 200 pages or 50MB.
Method 3: Ghostscript (Most Powerful Free Option)
Ghostscript is the Swiss Army knife of PDF tools. It can repair many types of corruption by re-interpreting and re-writing the PDF:
Install Ghostscript:
- Ubuntu/Debian:
sudo apt install ghostscript - Mac:
brew install ghostscript - Windows: Download from ghostscript.com
Repair command:
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=repaired.pdf corrupted.pdf
This command reads the corrupted PDF, re-renders each page, and writes a clean new PDF file. It fixes most structural errors including:
- Broken cross-reference tables
- Missing or damaged file headers
- Corrupted page trees
- Damaged font references
- Broken object streams
Ghostscript does not always recover every element. Complex graphics, embedded multimedia, and JavaScript may be lost. But for text and standard images, the recovery rate is high.
Method 4: QPDF (Structural Repair)
QPDF is another free command-line tool that specializes in PDF structural repair. It is less aggressive than Ghostscript — instead of re-rendering pages, it fixes the PDF structure directly:
Install QPDF:
- Ubuntu/Debian:
sudo apt install qpdf - Mac:
brew install qpdf - Windows: Download from GitHub releases
Repair command:
qpdf --qdf --object-streams=disable corrupted.pdf repaired.pdf
QPDF is particularly good at fixing:
- Broken linearization (fast web view)
- Encrypted files with lost passwords (if the encryption is weak)
- Files with incorrect cross-reference offsets
- PDFs that fail validation checks
Method 5: mutool (Lightweight Repair)
mutool is part of the MuPDF library. It includes a "clean" command that can fix some types of corruption:
mutool clean corrupted.pdf repaired.pdf
This rewrites the PDF, removing redundancies and fixing structural issues. It is fast and handles most common corruption types. Not as thorough as Ghostscript but quicker and less likely to alter the document's appearance.
Method 6: Restore from Backup or Version History
Before spending time on repair tools, check if you can recover an earlier version:
- Cloud storage: Google Drive, Dropbox, and OneDrive keep version history. Right-click the file and look for version history or previous versions.
- Windows File History: If enabled, right-click the file, select Properties, and check the Previous Versions tab.
- Mac Time Machine: Enter Time Machine and browse to an earlier version of the file.
- Email attachments: If the PDF was sent via email, the original attachment might still be in your sent folder.
What Cannot Be Repaired
Some corruption is beyond recovery:
- Severely truncated files: If more than half the file data is missing (very small file size compared to expected), there is not enough content to recover.
- Encrypted files with lost passwords: Strong encryption cannot be bypassed. If you lost the password, the file is inaccessible.
- Overwritten files: If new data was written over the PDF, the original content is gone.
- Zero-byte files: A file with 0 bytes contains nothing. There is nothing to repair.
How to Prevent PDF Corruption
Prevention is always better than repair. Follow these practices:
- Verify downloads: After downloading a PDF, check that the file size matches what was expected. A truncated download is the most common corruption source.
- Use "Save As" instead of "Save": When editing PDFs, use Save As to create a fresh file. Repeated saves to the same file can accumulate structural errors.
- Eject drives safely: Always eject USB drives and network shares before disconnecting. This ensures all file writes complete properly.
- Keep backups: Store important PDFs in cloud storage with version history (Google Drive, Dropbox) or maintain regular backups.
- Use reliable PDF tools: Cheap or free PDF editors from unknown sources may produce files with structural issues. Stick with well-known tools.
- Avoid email for large PDFs: Email servers can corrupt large attachments. Use file sharing services (Google Drive, WeTransfer) for documents over 10MB.
- Check disk health: Run disk diagnostics periodically. Failing hard drives corrupt files silently before they fail completely.
When to Use Professional Recovery Services
If the PDF contains critical data (legal documents, financial records, medical files) and free tools cannot recover it, professional data recovery services may help. These services use specialized tools and techniques that go beyond what free software can do. Expect to pay $100-500 depending on the complexity.
The Bottom Line
Start by trying to open the file in a different PDF reader — this alone fixes many "corruption" issues. If that fails, try Ghostscript or QPDF from the command line. For non-technical users, online tools like PDF24 Repair offer a simpler path. And always keep backups of important documents. Repair tools can work wonders, but they cannot recover data that no longer exists.