Skip to content
DeviceCheckHub

Repair PDF

Fix a PDF that won’t open or opens with errors. See what is wrong with it, preview the recovered pages, and download a repaired copy. Your PDF never leaves your device.

Choose or drop a damaged PDF. It stays on your device.

How to repair a PDF

  1. Choose the PDF that won’t open, or drop it on the box. The check starts at once.
  2. Read what the check found: each problem in the file is named in plain words, such as a file that was cut off or an index that points to the wrong places.
  3. Look at the previews of the first pages to see that they came back as they should, and at how many pages were recovered.
  4. Press Download repaired PDF. The copy is saved with -repaired added to its name.

Why PDFs get damaged

A PDF is a set of numbered parts (pages, fonts, pictures and page contents) followed by an index, called the cross-reference table, that gives the exact position of each part in the file. At the very end, a pointer says where that index starts. A reader jumps to the pointer, reads the index, and then goes straight to whatever it needs. That makes PDFs quick to open, but it also means one wrong number can stop a file from opening at all.

How the repair works

First the file is checked the way a careful reader would: whether it starts with a PDF header or has other data before it, whether its end is there, whether the pointer leads to the index, whether each entry in the index points at its part, whether each stream of data is as long as it says, and whether parts that are referred to are actually in the file. Each problem found is listed, with how many times it occurs.

Then the file is read again from start to finish, collecting every numbered part it holds without using the old index. Packed parts (object streams, which many programs have used since PDF 1.5 brought them in 2003) are unpacked as well. When a stated length is wrong, the end of the data is found by its end marker instead. The pages are then gathered from the file’s list of pages; if that list is missing or broken, every page found in the file is used, in order, and each keeps the size, fonts and resources it was given by the list above it. Finally a new file is written with a new, correct index.

The repaired copy is opened again with PDF.js, the PDF reader built into Firefox, before you can save it. The page count and the previews you see come from that copy, not from the damaged file, so what you see is what other readers will open.

When pages can only be saved as pictures

If too little of the file’s structure is left to rebuild it, but PDF.js can still draw its pages, the tool offers Save pages as pictures. Each page is drawn at 150 dots per inch and put into a new PDF as a picture, at its original size. This keeps how the pages look, which is often enough to print or read a document, but the text becomes part of the picture. To make it searchable and copyable again, run the new copy through OCR PDF.

If the repair doesn’t help

Private by design

Damaged files are often important ones: contracts, statements, theses and scans that you can’t easily replace. This tool never uploads them. Your browser reads the file, rebuilds it and shows the previews on your device, and nothing about it is saved or sent anywhere.

PDFs are rebuilt with pdf-lib by Andrew Dillon (MIT license), which uses UPNG, standard fonts data and pako. Pages are checked and drawn with PDF.js by Mozilla (Apache 2.0 license), with its character maps from Adobe, the Foxit and Liberation fonts, color profiles, and image decoders built from PDFium’s JBIG2 (build), OpenJPEG (build) and qcms (build).

Frequently asked questions

Why won’t my PDF open?

Most often the file is incomplete or its internal index is wrong. A PDF ends with a list that says where each part of the file is; when a download stops early, an email program adds text to the start, or a program saves the file badly, that list no longer matches and readers give up with messages such as “the file is damaged and could not be repaired”. This tool finds the parts without trusting the list and builds a new, correct one.

Is my PDF uploaded?

No. Your browser checks and rebuilds the PDF on your own device, so nothing is sent to this website or anyone else. Many other repair sites upload your file to their servers first.

Can every damaged PDF be repaired?

No. A file that was cut off loses whatever came after the cut, and those pages can’t be brought back; the tool tells you how many pages were recovered out of how many the file lists. A file that is mostly zeros or random data, or that is really another kind of file, can’t be rebuilt either. When the structure is too damaged to rebuild but the pages can still be drawn, the tool can save them as pictures.

Will the repaired PDF look the same?

Yes, when the pages are recovered. The text, fonts, pictures, links and form fields are copied as they are, not redrawn, so the text stays sharp and searchable. Only the file’s internal index and list of pages are written again. Check the page previews before you save.

What does “Save pages as pictures” do?

It is a last resort for files whose structure can’t be rebuilt. Each page is drawn the way a PDF reader would draw it and saved as a picture in a new PDF, at 150 dots per inch. The pages look the same, but their text can’t be selected or searched until you run OCR PDF on the new copy.

Can it repair a PDF with a password?

No. The contents of a protected PDF are encrypted, and rebuilding them without the password would only produce unreadable pages. If the file still opens with its password, remove the protection with Unlock PDF first, then repair the unlocked copy if it needs it.

My PDF opens here but not in another app. What now?

If the check finds no damage, the file’s structure is sound and the problem is more likely the other app, an old version of it, or a feature it doesn’t support. Downloading the clean copy that this tool writes can still help, because its index and its list of pages are written fresh.

Last updated · About DeviceCheckHub