# PDF Compressor

> Make PDF files smaller so they fit email and upload limits. Text stays selectable and the file never leaves your computer.

- Open in browser: https://pockettoolbox.org/en/pdf-compressor
- Runs entirely in your browser; files and input are never uploaded.

## How it works

Shrinks PDFs by recompressing the embedded images, or rebuilds the pages as JPEGs.

The default method finds every photo and scan inside the PDF, scales it down to a sensible resolution and stores it again as JPEG. Fonts, vector graphics, links and form fields are left alone. For pure scans there is a second method: each page is rendered and placed as an image into a new PDF. If a file does not get smaller, you get the original back.

pdf-lib reads the object structure. DCTDecode (JPEG) images are decoded by the browser, FlateDecode images are inflated with DecompressionStream, PNG predictors are reversed and the result is re-encoded as JPEG via canvas. An image is only replaced if it gets at least 10 % smaller. Soft masks (SMask) are kept, CMYK, indexed and JPX images stay unchanged. The file is saved with object streams. Image mode renders the pages with pdf.js.

## FAQ

### Why does my PDF barely get smaller?

If a PDF is mostly text, its size usually comes from embedded fonts, which cannot be shrunk in a useful way. Photos and scans are where the big savings are.

### Does the text stay searchable?

With "Shrink images" yes, text and links are unchanged. Only "Rebuild pages as images" turns each page into a picture, after that nothing can be selected.

## Popular tasks

- [Compress a PDF](https://pockettoolbox.org/en/compress-pdf)

---
PocketToolbox (https://pockettoolbox.org/en)
