Compress PDF

Reclaim the space a PDF wastes on itself — without uploading the document.

Compression level

This reclaims structural waste — it does not re-compress the images inside the document, because doing that would destroy the text layer.

Written and maintained by the KitYards team About KitYards Last reviewed:

Compress PDF rebuilds your document from the inside out. It copies the pages into a clean file, which drops every object the old one still referenced but no longer used, packs the cross-reference data into compressed object streams, and — depending on the level you pick — clears metadata, flattens form fields and removes annotations. You get the before size, the after size and the honest percentage. Everything runs in your browser through pdf-lib, so the document is never uploaded, and when a file is already tight the tool says so rather than handing back something bigger with a smaller-sounding label.

How to compress a PDF

  1. 1 Add the PDF you want to shrink.
  2. 2 Pick a level: Light rebuilds only, Balanced also clears metadata, Strong also flattens forms and drops annotations.
  3. 3 Press Compress and watch the progress bar work through the pages.
  4. 4 Check the before/after figures and download the result.

How the rebuild works

The file is parsed by pdf-lib and a brand-new empty document is created. Every page is then copied across, one at a time, with the tool yielding a frame between pages so the progress bar moves and the tab stays responsive. Copying a page brings only what that page actually references: its content stream, its fonts, its images, its colour spaces. Anything the old file still contained but no longer pointed at — a deleted image, a superseded revision, a font from a paragraph that was cut — simply has nothing to attach to and does not make the journey.

The new document is then serialised with object streams enabled. This packs the cross-reference table and every non-stream object into compressed streams instead of the plain text a naive writer emits, which on a document with many small objects is a meaningful saving on its own.

The two stronger levels go further. Balanced clears the document information dictionary, which also removes the XMP packet some producers leave behind. Strong first flattens the form — painting each field's current value onto the page so the information survives — and then removes the annotation entries, which is where filled-in forms hide a surprising amount of their weight. Finally the result is compared with the original: if the rebuild did not actually save anything, your original file is what gets downloaded.

When this helps

A document that has been edited many times

Reports that have been through a dozen save cycles carry every intermediate revision. Rebuilding keeps only the current one, which is often the single biggest saving available.

A filled-in form

Interactive forms store an appearance stream for every field. On the Strong level those are flattened into the page and the widget structure is dropped, which typically takes a real bite out of the size.

Getting under an email attachment limit

Most mail servers stop at 25 MB. A document just over the line is often just over because of structural waste, and a rebuild is enough to get it through without touching the content.

Cleaning metadata before sharing

Balanced and Strong clear the title, author and keyword fields, which frequently still hold the internal filename, a template name or the name of whoever first created the document.

Where the wasted space in a PDF comes from

A PDF is an append-only format by design. Every time a document is saved, edited, signed or annotated, the new version can be written on the end while the old objects stay in the file, unreferenced but still taking up room. Add an uncompressed cross-reference table, an XMP metadata packet several kilobytes long, and the appearance streams of a form that has been filled in, and a document that should be 400 KB is comfortably a megabyte. Rebuilding it discards all of that, and doing it in your browser means the contract or medical record you are shrinking never leaves your device.

What it cannot do

This is deliberately not an image re-compressor, and that sets the ceiling:

  • It does not re-encode images. A scanned document is almost entirely image data, so it will barely move. Shrinking one means lowering the image quality, which destroys the text layer, and that is a decision for you rather than a hidden default.
  • It does not subset fonts. A document embedding a full font family for three characters keeps that family. Proper subsetting needs a font engine well beyond what belongs in a browser tool.
  • Password-protected PDFs are refused. pdf-lib cannot decrypt content streams, so an encrypted document would rebuild into blank or garbled pages. Remove the password in your PDF reader first.
  • Very large files are bounded by your device's memory: the whole document is held in RAM while it is rebuilt.
  • Bookmarks, the table of contents and the tagged-PDF accessibility structure are not carried over. If you rely on those, keep the original.

Troubleshooting

It says "already optimised" and gave me my file back
The rebuild came out no smaller, so the original was returned rather than a worse copy. Your file was already written this way — usually because it was exported once, cleanly, from a modern tool. Nothing is wrong.
My 30 MB scan only lost 200 KB
Expected. Scans are images, and images are not re-compressed here. To shrink one, export the pages with PDF to JPG at a lower resolution and rebuild them with Image to PDF — accepting that the result is pictures of pages, with no text layer.
The form fields are no longer editable
That is the Strong level doing what it says: fields are flattened so their values are permanent. Use Balanced or Light if you need the form to stay interactive.

Frequently asked questions

How much smaller will my file get?

It depends entirely on what is wasting space. A document that has been edited and re-saved many times, or one that carries a filled-in form, can lose a third or more. A file exported cleanly once from a modern tool may lose almost nothing — there was nothing to reclaim.

Why did nothing happen to my scanned document?

Because a scan is essentially a stack of JPEGs, and this tool does not re-compress images. The images are the file, so the structural savings are a rounding error. To genuinely shrink a scan you have to re-encode the images, which destroys the text layer — a trade this tool does not make silently on your behalf.

Is anything lost?

On Light, no: only unreferenced objects and packing change. On Balanced, document metadata (title, author, keywords) is cleared. On Strong, form fields are flattened — their values are painted onto the page but can no longer be edited — and annotations and links are removed.

Is my PDF uploaded?

No. pdf-lib runs in your browser. Open the Network tab of your developer tools while compressing, or disconnect from the internet after the page has loaded — the compression still completes.

Will the text still be selectable?

Yes. Pages are copied as objects rather than rasterised, so text stays real text, vectors stay vector and images keep their original encoding at every level.

Other recommended tools