# Repair PDF Online - Fix Damaged, Corrupt or Truncated PDFs

> Fix corrupt PDFs that won’t open: diagnoses header, xref, trailer and truncation problems, rebuilds the xref and page tree, re-renders as a last resort. Free.

- URL: https://qilingtools.com/en/pdf/repair
- Category: PDF Tools (https://qilingtools.com/en/pdf)
- Tags: [PDF](https://qilingtools.com/en/tags/pdf), [Documents](https://qilingtools.com/en/tags/document)
- Last updated: 2026-10-26
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

A PDF that won’t open, complains that it is damaged or that the cross-reference table can’t be read, or was cut short by an interrupted download? The tool starts with a check-up: is the %PDF header pushed back by junk bytes, is the %%EOF marker missing, does startxref point at a real cross-reference table, are the object offsets in that table correct, are the trailer and document catalog (/Root) still there, and does each stream’s /Length match its data? Every problem found is listed. Repair first reads all objects with a lenient parser that doesn’t rely on the broken offset table. If that fails, or the file is truncated, it scans for every ‘N 0 obj … endobj’ itself and rebuilds a clean file — keeping the last complete version of each object number and decompressing as much of a truncated stream as possible, so even half a page of text can survive. It then fixes the document catalog and page tree: a missing catalog is located again or recreated, a broken page tree is rebuilt from the page objects found, missing page sizes and resources are filled in, and references to objects that no longer exist are removed. The result is checked page by page with PDF.js; if the structure really can’t be saved, PDF.js — the most forgiving parser — renders every page it can display into a new image-based PDF. A repair report shows what was wrong, what was fixed and how many pages were recovered. Everything runs in your browser; files are never uploaded.

## How to use

1. Upload a PDF that won’t open or shows errors; it is diagnosed and the problems are listed
2. Choose structural repair (keeps text, falls back to re-rendering) or re-render straight away
3. Click Repair & download, read the repair report and save the fixed PDF

## Features

- Checks header, %%EOF, startxref, xref offsets, trailer and stream lengths
- Lenient parsing that doesn’t depend on a broken xref
- Rebuilds xref and trailer by scanning objects, newest complete version wins
- Truncated files: salvages the readable part of cut-off streams
- Repairs or rebuilds the catalog and page tree, fills in page sizes and resources
- Removes dangling references
- Page-by-page PDF.js check with re-render fallback
- Detailed repair report, runs locally with nothing uploaded

## FAQ

### What kind of damage can be fixed?

Wrong cross-reference offsets, a missing trailer or startxref, junk before the header, wrong stream lengths, a broken page tree and a lost document catalog are structural problems that can usually be fixed completely without losing content. For truncated files, pages before the cut are normally recovered, the page where the cut happened may be partial, and anything after it is simply no longer in the file.

### What’s the difference between structural repair and re-rendering?

Structural repair keeps the original text, fonts and vector graphics, so text stays selectable and searchable — it’s always tried first. Re-rendering draws every page with PDF.js and builds a new PDF from the images: it looks the same, but text becomes part of the picture. It’s used automatically only when structural repair fails.

### Can encrypted PDFs be repaired?

Structural repair works and the result keeps the original encryption, so it still asks for the password. If you know the password you can unlock the repaired file with Unlock PDF afterwards. Re-rendering needs to open the file, so it doesn’t work for PDFs with an open password.

### Is my file uploaded? Does repair change the content?

Nothing is uploaded; it all happens in your browser. Structural repair rewrites only the file structure (cross-reference table, catalog, page tree) and leaves page content as it was. Data lost to truncation can’t be conjured back, and the report lists any incomplete objects that had to be dropped.

## Related tools

- [Merge PDF](https://qilingtools.com/en/pdf/merge): Free online PDF merger: combine several PDF files into one in the order you choose, with reordering. Processed locally in your browser, no upload, no sign-up.
- [Split / Extract PDF](https://qilingtools.com/en/pdf/split): Free online PDF splitter: extract a page range into a new PDF, or split every page into its own file and download them as a ZIP. Processed locally.
- [Rotate PDF](https://qilingtools.com/en/pdf/rotate): Free online PDF rotator: rotate all or selected pages by 90°, 180° or 270° to fix scanned documents. Processed locally, no upload.
- [PDF to Image](https://qilingtools.com/en/pdf/to-image): Free online PDF to image converter: render every page as a high-resolution JPG or PNG at 72/150/300 DPI, download all as a ZIP. Processed locally, no upload.
- [Image to PDF](https://qilingtools.com/en/pdf/from-image): Free online image to PDF converter: combine JPG, PNG and WebP images into one PDF in order, with A4 or image-sized pages. Processed locally, no upload.
- [Compress PDF](https://qilingtools.com/en/pdf/compress): Free online PDF compressor: re-render pages with compressed images to shrink scanned and image-heavy PDFs, with adjustable quality. Processed locally.
- [Watermark PDF](https://qilingtools.com/en/pdf/watermark): Free online PDF watermark tool: add text watermarks to every page, tiled or centred, with opacity and angle controls. Any language, processed locally.
- [Delete PDF Pages](https://qilingtools.com/en/pdf/delete): Free online tool to delete PDF pages: remove pages by number or range and keep the rest, then download. Processed locally, no upload.
