How to compress a PDF
- Drop your PDF into the zone above, or click to browse and select it.
- Choose your optimisation options. Remove metadata strips the document title, author, creation date, and other invisible properties. Remove annotations removes comments and markup added to the document.
- Click Compress & download. The tool shows the before and after file sizes, and the optimised PDF downloads to your device.
Everything runs in your browser using pdf-lib.
No file is sent to a server — open DevTools (F12) → Network while processing to verify zero upload requests.
What makes a PDF large
Most people assume compression is a single operation with a predictable outcome. In practice, the amount of size reduction you can achieve depends entirely on what is making the file large. There are four main sources of PDF file size, each requiring a different approach.
- Embedded images: By far the most common cause of large PDFs. A document with scanned pages, product photography, or design graphics embeds each image at its original resolution. A single full-page photograph at 300 DPI can be 3–5 MB. A 30-page scanned document at 200 DPI can easily reach 50 MB. Reducing image-heavy PDFs requires re-encoding the images at lower resolution — something only server-side tools can do well.
- Embedded fonts: PDF can embed complete font files for every typeface used in the document. A single professional OpenType font can be 500 KB–2 MB. A PDF using three or four custom fonts carries several megabytes of font data that contributes nothing to the visual output for readers who never need to edit the document. Subsetting (embedding only the characters actually used) reduces this significantly, but few export tools do it aggressively.
- Metadata and document overhead: Author, title, keywords, revision history, comments, annotations, and internal cross-reference tables add overhead that has nothing to do with what readers see. For PDFs exported from design tools like Adobe Illustrator or InDesign, this overhead can be substantial — sometimes 30–40% of the total file size. This is the overhead this tool removes.
- Unused and duplicate objects: PDF is an append-only format. When you edit a PDF in most tools, the old version of each modified object stays in the file as a dead object — the file grows but nothing visible changes. Re-saving with object compression removes these dead objects.
This tool addresses the third and fourth categories. For image-heavy PDFs where the first category dominates, see the server-side options below.
When to compress a PDF
- Email attachments — many email providers cap attachments at 10–25 MB. Stripping metadata and unused resources can bring a bloated PDF under the limit.
- Document portals and upload limits — government portals, insurance sites, and HR systems often impose strict file size limits on uploads.
- Removing author metadata before sharing — a report created in Word carries author name, company, and revision history in the PDF metadata by default. Stripping it before sending removes that information.
- Cleaning up PDFs exported from design tools — Illustrator and InDesign exports often include significant metadata overhead that contributes nothing to the document content.
- Archiving — removing unused objects and annotations produces a cleaner, more compact file for long-term storage.
How it works under the hood
pdf-lib loads the PDF and rewrites it with the useObjectStreams: true option, which compresses
the document's cross-reference table — an internal index of all objects in the file. This alone can reduce
file size by several percent for PDFs with many objects.
Stripping metadata removes the document information dictionary, which stores title, author, subject, keywords, creator, and producer fields. These are invisible to readers but add bytes to every copy of the file. Removing annotations deletes the annotation arrays attached to each page — comments, highlights, and markup left by reviewers.
What this tool does not do: re-encode embedded images at lower quality. Image data is the dominant source of file size in most PDFs, and reducing it requires re-rendering images at a lower resolution — a process that can only be done well with tools like Ghostscript. A server-based compression tool is more effective for image-heavy PDFs; we plan to add this as an optional cloud processing feature.
Limits and what to expect
- Image-heavy PDFs: if most of the file size comes from embedded images, this tool will produce minimal reduction. The largest size wins require re-encoding images, which this tool does not do to preserve quality.
- Already-optimised PDFs: PDFs exported from modern tools with compression already applied may see little or no size reduction.
- Password-protected PDFs: must be unlocked before use.
- Annotation removal scope: removes standard annotations (comments, highlights, sticky notes). Interactive form fields are not removed by the annotations option.
- Browser support: Chrome 90+, Firefox 90+, Safari 15+, Edge 90+.
File size targets for common use cases
Different destinations have different limits, and knowing the target helps you decide how much compression you actually need:
- Email attachments: Gmail caps at 25 MB, Outlook at 20 MB, many corporate mail servers at 10 MB or 5 MB. If your PDF is under 10 MB, it will get through most email systems. If it is over 20 MB, focus on image compression first — metadata removal alone will not bring a 50 MB PDF to below email limits.
- Web upload portals: Government forms, insurance portals, HR systems, and legal submission systems typically impose 5–10 MB limits. Some are stricter — 2 MB is common for passport and document scans.
- Cloud storage sharing: No size limits in practice, but very large PDFs take time to open in browser-based viewers. Under 5 MB is comfortable for most viewers.
- Print-ready PDFs: Print files should not be compressed aggressively — images need to stay at 300 DPI minimum. For print submissions, metadata removal is useful; image compression is not.
When browser-based compression is not enough
If your PDF is large because of embedded images — scanned pages, photographs, design graphics — this tool will make little difference. The PDF's size comes from pixel data, and reducing pixel data requires re-encoding the images at lower resolution. This is computationally intensive and best done with purpose-built tools:
- Ghostscript (free, command line): The engine behind most server-side PDF compressors. Running it with
-dPDFSETTINGS=/ebooktypically reduces image-heavy PDFs to 20–30% of their original size at acceptable quality for screen use. Requires a technical setup but is the most powerful free option. - Chrome print-to-PDF (free, any OS): Open the PDF in Chrome, press Ctrl+P, save as PDF. Chrome re-renders and recompresses images in the process. Quick, but may alter formatting subtly.
- macOS Preview Quartz filter (free, macOS): File → Export → Quartz Filter: "Reduce File Size." Aggressive image compression. Quality is visibly degraded but acceptable for documents where readability matters more than visual fidelity.
- Adobe Acrobat Pro (paid): The most controlled option. The PDF Optimizer lets you set target image resolution separately for colour, grayscale, and monochrome content, giving you the best balance of size and quality.
For metadata-heavy PDFs from office or design tools — where the images are already compressed but overhead is adding unnecessary size — the browser-based approach here is genuinely the right tool, and the results are fast and lossless.
Privacy compared to other PDF compressors
Online PDF compressors upload your file to a server, compress it there, and serve it back. The irony is that compressing a sensitive document — a contract, financial report, or patient record — on a third-party server exposes it to the same risks as any other upload. You are trusting a company you have never audited with your most private documents.
keptlocal compresses entirely in your browser. The PDF bytes move from your disk to your browser's memory, get optimised, and download back to your disk. No server is involved. Verify it in the Network tab — zero outbound file transfers.