Skip to content
ToolStash

Compress PDF

Shrink a PDF by re-encoding the images inside it, with a quality setting you control and honest before/after numbers. The work happens in your browser, so the document is never uploaded.

Runs entirely in your browser — nothing is uploaded

Drop a PDF here to compress it

Works best on scans and image-heavy documents. Nothing is uploaded.

How to use it

  1. Drop a PDF onto the box above, or click Choose a file.
  2. Set the image quality — 60 per cent is a good default for scans and photos.
  3. Optionally cap the maximum image size. For anything that will be read on screen, 1600 px is plenty and usually saves more than quality alone.
  4. Click Compress PDF. The before and after sizes appear immediately, with a count of how many images were re-encoded and why any were skipped.
  5. Download the result — and check a page or two before deleting your original.

How it works

The size of a large PDF is almost never its text. A 40-page report of prose might be 200 KB; a single scanned page can be 3 MB. The difference is bitmap images, and that is the only thing worth attacking.

So compression here means going after the images specifically. The document’s object graph is walked to find every image XObject — the objects a PDF uses to store bitmap data. Each one is decoded, redrawn onto a canvas at the size you asked for, re-encoded as JPEG at your chosen quality, and written back into the document at the same object reference. Everything else in the file is left completely alone.

Two decoding paths cover the images that matter. An image stored with DCTDecode is already a JPEG file, so its bytes go straight to the browser’s own JPEG decoder — which is also why CMYK and progressive JPEGs come out correctly rather than needing special handling. An image stored with FlateDecode holds raw pixel samples, which are expanded to RGBA and turned into a bitmap. Only the layouts that can be reconstructed without guessing are accepted: 8-bit DeviceRGB and DeviceGray, with no remapping array.

The work is deliberately cautious. An image is only replaced when it decoded cleanly and the re-encoded version is genuinely smaller — if JPEG comes out bigger, the original stream stays. Transparency masks are skipped entirely, because lossy artefacts on a mask show up as halos around whatever it is masking. Anything under 4 KB or smaller than 100 × 100 pixels is skipped as not worth the risk. Every skip is counted with its reason, which is what makes it possible to say “your PDF did not shrink, and here is exactly why” instead of reporting a meaningless zero.

Tips

  • Try capping the image size before reaching for low quality. 1600 px at 70 per cent generally looks better and lands smaller than native resolution at 35 per cent.
  • Compress once. Running a file through twice compounds the artefacts for very little further gain.
  • If a document needs to be both small and legible, compress it and then open the result in the PDF Viewer at 200 per cent zoom. Judging quality from a thumbnail is how people end up sending unreadable scans.
  • Merging first with Merge PDF and compressing second gives a better result than compressing each part and then merging.

Frequently asked questions

Is my PDF uploaded to a server?
No. The document is read into your browser’s memory, each embedded image is decoded and re-encoded by your browser’s own codecs, and the rebuilt file is handed back as a download. Nothing is transmitted. Compression is the job people most often hand to a random website — usually with a bank statement or a scanned contract attached — and it is completely unnecessary to do so.
Why did my PDF barely shrink, or not shrink at all?
Almost certainly because it has no images in it. A PDF of text and vector graphics is already compact: the text is a few bytes per character and the fonts are shared across every page. There is nothing in it that re-encoding can shrink. The tool says so explicitly rather than reporting a pointless 0 per cent. The other common case is a document whose images are already well compressed — a PDF exported from a phone or produced by a good scanner app — where a second pass gains nothing and the tool tells you to keep your original.
How does it decide there is nothing to compress?
It walks the PDF’s object graph and counts the image objects it finds, then reports what happened to each one. Images are left alone when they are transparency masks (re-encoding those would put artefacts on the edges of whatever they mask), when they are under 4 KB or smaller than 100 × 100 pixels (logos and icons, where there is nothing to win), when they use an encoding browsers cannot decode such as JPEG 2000 or CCITT fax, or when the re-encoded version comes out no smaller than the original. Every one of those counts is shown, so a document that does not shrink comes with a reason.
How much smaller will my file get?
Scanned documents typically drop 60 to 90 per cent, because scanners produce large, lightly compressed images at resolutions far beyond what a screen needs. Photo-heavy presentations behave similarly. A text report may not change at all. The result is measured and shown before you download anything, so you never have to guess.
Will the text in my scanned PDF still be readable?
At the default 60 per cent quality, yes — scanned text survives well because it is high-contrast. Below about 40 per cent you will start to see blocky patches around letters, particularly on small print. If the scan has been through OCR, the invisible text layer is untouched regardless, so the document stays searchable and selectable no matter how far you compress the images.
Should I lower the quality or cap the image size?
Cap the size first — it is almost always the bigger win. A 300 DPI scan of an A4 page is around 2480 × 3508 pixels, which is roughly four times more detail than a screen can show. Capping to 1600 px removes three quarters of the pixels before quality even enters the picture, and looks better than the same file size achieved by pushing quality down.
Does it change anything other than the images?
No. Text, vector graphics, embedded fonts, bookmarks, links and form fields are all left exactly as they are — only image streams are replaced, in place, at the same object references. Page count, page sizes and page order are untouched. Re-encoded images become JPEG, so any transparency in them is flattened onto white, though separate transparency masks are preserved.
Is the compression lossy? Can I undo it?
It is lossy, and it cannot be undone — that is what makes the file smaller. Detail thrown away by JPEG encoding is gone, and compressing an already-compressed image a second time degrades it further. Always keep your original until you have checked the result, and never compress the same file repeatedly.
Why is my password-protected PDF rejected?
Reading the images requires decrypting the document, and this tool does not attempt to bypass encryption. Open the file in your PDF reader with the password, save an unprotected copy, and compress that.

Browse every tool in PDF Tools.

Found a bug or want a feature? Tell us — ToolStash is built from user requests.