Compress a PDF

Compression is the PDF operation people are most often misled about. A tool reports a big saving by throwing away image quality you did not agree to lose, or reports a tiny one and does not say why. This does the two things that reliably help, tells you in advance which of them will do anything for your particular file, and keeps the original if the result is not smaller.

or drop a file anywhere on this panel

opened locally · 0 bytes sent

How it works

  1. 01Open the PDF.
  2. 02Read the panel: it says whether this document has anything to give before you run anything.
  3. 03Adjust the effort level if you want. The preview shows genuinely compressed output, not an estimate.
  4. 04Export.

The numbers, measured not claimed

Against a fixed corpus of five generated documents: 91% smaller overall for documents whose images are stored losslessly, 3% for a text-only document, and — this is the important one — close to zero on a second pass over an already-compressed file. That last figure is the realistic floor for a document that has been through any other compressor, or that came out of a scanner as JPEG. Anyone quoting only the first number is selling you something.

What it actually does

Two things. It rewrites the file with object streams and recompresses every Flate stream at maximum effort, which is where the saving on a text-heavy document comes from. And it converts images to JPEG where that produces a smaller image than the original encoding. Both are done by qpdf, which is permissively licensed and already part of this app.

What it does not do yet

It reduces image resolution, which is where nearly all the saving lives. A photograph stored at 800 DPI inside a two-inch box is carrying detail no screen and no printer can show; reducing it to the resolution you choose is usually invisible and often the difference between twelve megabytes and one. Pick screen, web or print — or turn it off to keep every pixel. Images already close to the target are left alone, because re-encoding them would cost a little quality to save almost nothing.

It will never make your file bigger

Compression genuinely can increase a file size — object streams add overhead, and re-encoding an already-optimal image is a net loss. When the result is not smaller, the original is returned unchanged and the tool says so. Several well-known compressors do not do this.

Why not the engine everyone else uses

The two best-known PDF compression engines are dual-licensed under the AGPL or a paid commercial licence. Using either would require open-sourcing this entire service or paying a per-deployment fee, and we chose neither. The consequence is visible in the numbers above: on already-JPEG documents we currently save less than a Ghostscript-based tool would. We would rather publish that than hide it.

Questions

Will it damage my images?
Converting a lossless image to JPEG is by definition lossy, and that is where most of the saving comes from. The preview runs the real compression rather than showing you the original, so you can see the result before exporting. Turn the image conversion off to keep the file mathematically identical in its images and take only the structural saving.
Why did my file barely shrink?
Check the image detail setting. If it is on “leave images at full resolution”, only the encoding is optimised, and on a document whose images are already JPEG there is very little left to take. Choosing a target resolution is what unlocks the large savings.
How does this compare to iLovePDF or Smallpdf?
We have not published a side-by-side comparison yet, and will not claim one until we have measured it properly. Both halves of the job are now in place — JPEG conversion and resolution reduction — so the comparison is worth running; until it is run, the honest answer is that we do not know.
Is my file uploaded to compress it?
No. qpdf runs as WebAssembly inside your browser. Compression is one of the operations people most often perform on documents they would not want to send anywhere.