PortImg Insights

How to Compress a PDF Without Losing Quality, and When You Can't

Date
Updated
Read time3 min read
How to Compress a PDF Without Losing Quality, and When You Can't

Lossless PDF compression shrinks text documents but not scans. See our measured results, why PDFs get big, and how to make a scanned PDF smaller.

A PDF is too big to email, or an upload form says "maximum 2 MB". The usual advice is to run it through a compressor, and sometimes that works well. Sometimes it does almost nothing. Which one you get depends on what is inside the PDF, and once you know that, you can pick the method that will actually work.

Why PDFs get big

A PDF is a container. Text is stored as characters plus the fonts needed to draw them, drawings as instructions, and photos and scans as images. Text and drawings are compact: a 10-page report of plain text is usually well under a megabyte. Images are not. A single page scanned in color at 300 dpi is around 2500 × 3500 pixels, and a phone photo dropped into a document can be several megabytes on its own. In almost every oversized PDF, the size is in the images.

What lossless compression can do

Our Compress PDF tool runs in your browser with the open-source pdf-lib library. It rewrites the PDF's internal structure more compactly, packing its many small objects into compressed object streams, and leaves the content exactly as it was: every letter, line and image is unchanged. In our tests:

PDFResult
10-page text document26% smaller
PDF made of photosNo smaller at all

That is the honest limit of lossless compression: it helps documents whose size is in their structure and text, and cannot touch documents whose size is in their images. Results vary with the program that made the PDF: files that already use object streams, as most recent software writes them, shrink less.

One more thing changes: because the file is rewritten, a digital signature on it (for example on an e-signed contract) is no longer valid. Keep the signed original and compress a copy.

Making a scanned or photo-heavy PDF smaller

To shrink a PDF of scans or photos, the images themselves have to get smaller, which means fewer pixels or stronger compression. Some ways to do that:

  • Scan at a lower resolution. 150 dpi is enough for reading on screen and printing ordinary documents; 300 dpi is only needed for small print or archives. Halving the resolution cuts the pixels to a quarter.
  • Scan in grayscale unless you need color. A color scan stores three times as much as a grayscale one before compression.
  • Build the PDF from smaller images. If you are making the PDF from phone photos, shrink them first with Compress Image or Resize Image, then combine them with Image to PDF. JPG photos go into the PDF unchanged, so the PDF ends up roughly the size of the photos; our guide to merging images into a PDF has the measurements.
  • Use a desktop tool that downsamples images. Ghostscript, for example, can rewrite a PDF with every image reduced to 150 dpi (its "ebook" setting). This does lower image quality, so check the result before you send it.

Check what you are dealing with

A quick way to tell which kind of PDF you have: try to select a line of text. If you can, the page is real text, and lossless compression may help. If the whole page selects as one block or nothing selects, the page is an image, and only the methods above will make it meaningfully smaller.

Privacy

Compress PDF works on PDFs up to 10 MB entirely in your browser; the file is not uploaded. For a bigger PDF, split it in a desktop PDF program or reduce its images first.

Written and tested by the PortImg team: the figures in this guide come from running files through our own tools. How we test

Image ToolsPDFTutorial
Found this helpful?

Try PortImg's free tools

Convert, compress, and edit images and PDFs — no sign-up needed.

Explore tools