ImagePDF.Tools
Technical

How to Repair and Recover Corrupted PDF Files That Won't Open (Recovery Guide)

N
NikolaLast updated on October 25, 2026 · 6 min read

Summary

Why PDFs get damaged, how to tell whether a broken file can be saved, and how to rebuild a missing cross-reference table or end marker to get the pages back.

A PDF that will not open is usually not wiped out. In most cases the file was cut short or its internal index is broken, while the pages themselves are still sitting inside it. Work through three steps in order: open it in a different reader, rebuild it with a repair tool, and if both fail, get a fresh copy from wherever it came from.

Before you start, make a copy of the damaged file and only work on the copy. The one situation nobody can fix is content that was never written. If a 40-page report is 12 KB, or the file is 0 bytes, the pages are not in there to recover.

A damaged PDF file being checked and rebuilt into a readable copy | ImagePDF.Tools
Most damaged PDFs still contain their pages. What breaks is the index that tells a reader where they are.

What "the file is damaged and could not be repaired" actually means

Every reader words the failure differently. Adobe Acrobat and Reader say "There was an error opening this document. The file is damaged and could not be repaired." Chrome shows "Failed to load PDF document." macOS Preview says the file could not be opened because it may be damaged or in a format Preview does not recognize.

Underneath, they all mean the same thing. The reader went looking for the file's structure in the place the format says it should be, and did not find it.

Why PDFs break at the end first

A PDF is a set of numbered objects: pages, fonts, images and the streams that draw text. Near the very end of the file sits the cross-reference table, or xref, which lists the byte position of every object. After it comes a startxref line pointing to that table, and finally a %%EOF marker.

A reader starts at the last bytes, follows the pointer to the table, and uses the table to jump to each page. That design is fast, but it means the most important part of the file is the part most likely to go missing when something interrupts it.

These are the usual culprits:

  • ●A transfer that stopped early. A browser that lost its connection, a phone that dropped signal, or a sync client that copied a file while it was still being written. The tail, with the index, never arrived.
  • ●Extra bytes before the header. Some mail gateways and document systems add data ahead of %PDF-. Every byte position in the index is then off by that amount.
  • ●A crash during save or export. An app that quits mid-write can leave objects half finished and no index at all.
  • ●A file that is not a PDF. A login page or error page saved with a .pdf name, or a Word file renamed by hand, looks damaged because there is no PDF inside.
  • ●Failing storage. An old USB stick or SD card can return scrambled blocks in the middle of a file that was fine when it was saved.

Check the file in two minutes before fixing it

  1. 1.Look at the size. Compare it with what the sender quoted or with similar files. A scan of 20 pages that weighs a few kilobytes is missing its content, not just its index.
  2. 2.Look at the first line. Open the file in a plain text editor such as Notepad on Windows, TextEdit in plain text mode on a Mac, or VS Code. A real PDF starts with %PDF- and a version, for example %PDF-1.7. If you see <!DOCTYPE html> or <html, you saved a web page. If you see PK, it is a ZIP-based file such as a .docx.
  3. 3.Look at the last line. Jump to the end of the file. A complete PDF ends with %%EOF, usually a few lines after startxref and a number. If it stops in the middle of binary noise, the file was truncated.
⚠️

Close the text editor without saving. Saving a PDF from a text editor can change line endings or character encoding and damage the binary data further.

Fix 1: open it in a more forgiving reader

Readers differ in how hard they try. Acrobat gives up quickly on some faults that Firefox, Chrome or a phone's built-in viewer quietly work around by scanning the whole file for objects and building an index in memory. Try at least two of them.

If one reader shows the pages, use its print dialog to write a fresh copy: choose Microsoft Print to PDF on Windows, or Save as PDF on a Mac or in Chrome. The new file has a clean structure. Text usually stays selectable, but form fields, bookmarks and links may not survive, so keep the damaged original until you have checked the copy.

Fix 2: rebuild the file with a repair tool

When no reader opens the file, a repair tool reads it differently. Instead of trusting the broken index, it scans the bytes for every object it can find, then writes a new file with a new cross-reference table.

In your browser

Our Repair PDF tool runs on your device and does not upload the file, which matters when the broken file is a contract or a medical record. It first lists what looks wrong, such as a missing header, no end marker, an index pointer past the end of the file, or objects that were never closed. Then it tries several methods, gentlest first:

  1. 1.A full rebuild that finds every object and writes a fresh index. Text, fonts and images come through as they were.
  2. 2.Copying readable pages one at a time, so a single broken page is dropped instead of failing the whole file.
  3. 3.Gathering loose pages when the page list itself is gone, which is common after a truncated transfer.
  4. 4.Pulling intact JPEG page images out of the raw bytes, which rescues many old scans.
  5. 5.As a last resort, drawing whatever pages still open as images.

The report tells you which method worked and how many pages could not be saved. If the result came from one of the image-based methods, run it through OCR PDF to make the text searchable again.

On the command line

Three free tools handle repair well. Each one writes a new file and leaves the damaged one untouched:

bash
qpdf damaged.pdf repaired.pdf
mutool clean -gg damaged.pdf repaired.pdf
gs -o repaired.pdf -sDEVICE=pdfwrite damaged.pdf
  • ●qpdf tries to reconstruct a broken cross-reference table by default and prints a warning for each problem it finds. It copies objects as they are, so the content is not re-encoded.
  • ●mutool clean comes with MuPDF. It repairs the structure while rewriting, and -gg also drops unused objects and compacts the index.
  • ●Ghostscript with the pdfwrite device interprets every page and produces a brand new PDF. It tolerates the most damage of the three, but because it rebuilds rather than copies, check fonts and image quality in the result.

What repair cannot bring back

  • ●Missing data. If a transfer stopped at 60 percent, the content in the last 40 percent was never received. Repair recovers the pages that exist, not the ones that were cut off.
  • ●Half an image. A photo whose data was cut partway may show only its top part, with the rest gray or blank.
  • ●The original page order, sometimes. When the page list is gone, loose pages are put back in the order of their internal object numbers. That usually matches the original, but not always. Drag them back into place with Organize PDF.

Getting a clean original is often easier

Repair is a rescue. A good copy of the original is always better, and there are more places to find one than people expect:

  • ●Fetch it again from the email or web page it came from. If an attachment keeps arriving broken, ask the sender for a cloud share link instead.
  • ●Check version history. OneDrive, Google Drive and Dropbox all keep earlier versions of files that were overwritten, so a good copy from before the damage may still be there.
  • ●On Windows, right-click the file or its folder, choose Properties, and open the Previous Versions tab. It lists copies when File History or restore points covered that folder.
  • ●On a Mac with Time Machine, open the folder in Finder and enter Time Machine to browse earlier copies.
  • ●If you made the PDF yourself, export it again from Word, InDesign or whichever app created it.
ℹ️

Most damage happens in transit. Wait for a browser or sync client to finish before you open, move or attach a file, and eject USB drives before you unplug them.

Frequently asked questions

Why does the PDF open on my phone but not on my computer?
The phone's viewer is more forgiving and rebuilt the broken index in memory without telling you. Use the share or print option on the phone to save it as a new PDF, then move that copy to your computer.
Will repairing change my text or images?
Not when the file is rebuilt or salvaged page by page, because the existing objects are copied as they are. Only the last-resort methods that turn pages into images change the content: the pages look the same, but the text is no longer selectable until you run OCR.
The repaired file is much smaller than the broken one. Is something missing?
Not necessarily. A rebuild drops unused and duplicate objects that older edits left behind. Compare the page count in the repair report with the page count you expected; if they match, the size difference is just leftover data that was cleaned out.
Can a repair tool remove a password from a damaged PDF?
No. Repair fixes structure, not encryption. If the file is protected and opens once repaired, use Unlock PDF with the password you were given. Without the password, neither tool can read the content.
Is it safe to use an online PDF repair service for confidential files?
Many online services upload your file to their servers to process it. If the document is sensitive, use a desktop tool such as qpdf, or a browser tool that works locally, so the file stays on your device.

Sources & references

This article was researched and written by Nikola, drawing on the following primary sources and documentation:

Ready to try it?

All tools run entirely in your browser, no uploads, no account required.

Repair PDF