Skip to content

Compress PDF

Reduce eligible JPG-heavy PDFs locally, without uploading the document.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Choose one local PDF up to 25 MB.
  2. 2.Select Compress PDF and wait while eligible embedded JPG images are checked and re-encoded locally.
  3. 3.Review the reported input and output sizes, then download the verified PDF if it is smaller.

About Compress PDF

Compress PDF is a bounded browser-only option for image-heavy PDFs. It opens one file locally, identifies embedded JPG image objects that can be replaced without changing their page references, and re-encodes only those images at a balanced quality and maximum dimension. The source file never leaves your browser tab.

This is deliberately narrower than a general-purpose PDF optimizer. The tool only changes unmasked DCTDecode JPG images with DeviceRGB or DeviceGray color data. It skips JPX, CMYK, Indexed, masked, ImageMask, and decode-parameter cases instead of guessing. If a newly encoded JPG is not actually smaller than its original byte stream, it keeps the original image. If no safe replacement is smaller, it returns an honest error and does not create a download.

Page content, page count, text, links, vector objects, forms, annotations, metadata, and unsupported image objects remain in the PDF structure. That also means a text-only PDF often cannot shrink, and the final file size depends on the source images and PDF overhead. The output is reopened with a PDF viewer before the download link is shown so a malformed result is not presented as success.

For safety, this version accepts a PDF up to 25 MB, up to 80 eligible image objects, and at most 100 megapixels across the images it decodes. Use it for scanned or photo-heavy documents when a visually smaller local copy is acceptable. Keep the original file and inspect the output before sharing it. Use a specialist desktop PDF optimizer if you need arbitrary stream compression, archival conformance, print color management, or guaranteed lossless results.

Methodology & sources

Load one bounded local PDF with pdf-lib, enumerate image XObjects, allow only unmasked DCTDecode DeviceRGB or DeviceGray streams without decode parameters, decode each eligible JPG in a browser image element, downscale its longest side to 1400 px at JPEG quality 0.70, retain the original whenever the candidate is not smaller, replace only smaller payloads at the same indirect reference, save, then reopen with pdf-lib and PDF.js to verify page count before exposing Download.

Frequently asked questions

Will every PDF become smaller?
No. Text-only PDFs and files without a safely replaceable JPG image normally cannot shrink with this bounded tool.
Which images can the tool change?
Only unmasked embedded DCTDecode JPG images using DeviceRGB or DeviceGray color data. Unsupported images remain unchanged.
Does it upload my PDF?
No. Reading, JPG encoding, output assembly, and verification all run in the current browser tab.
Does it preserve text and links?
Yes for the unchanged document structure. The tool replaces only eligible embedded image streams and does not rasterize whole pages.

PDF Tools guides

View all