PDF Published 2026-11-10

PDF Compression Techniques Explained: Lossless vs Lossy Methods

Why PDF Files Get Large

PDF documents can balloon in size for several reasons: high-resolution embedded images, multiple copies of the same font, uncompressed content streams, embedded thumbnails, and redundant object data. Understanding what makes PDFs large is the first step to compressing them effectively.

Lossless Compression Methods

Lossless compression reduces file size without any loss of quality. Every bit of the original data can be perfectly reconstructed.

Flate/Zlib Stream Compression

The most common lossless method in PDFs is Flate encoding (based on the DEFLATE algorithm, the same used in ZIP files). PDF content streams — the instructions that describe text placement, vector graphics, and page layout — can be compressed with Flate encoding. Most modern PDF creators apply this automatically, but older or poorly generated PDFs may have uncompressed streams.

Object Stream Compression (PDF 1.5+)

PDF 1.5 introduced cross-reference streams and object streams, which pack multiple small PDF objects into a single compressed stream. This is particularly effective for documents with thousands of small objects (bookmarks, form fields, annotations).

Font Subsetting

Embedding entire font files adds significant weight. Font subsetting includes only the glyphs (characters) actually used in the document. A full font file might be 200 KB, but if the document only uses 50 characters, the subset might be 15 KB. This is lossless because the rendered text looks identical.

Removing Redundant Data

Many PDF generators embed unnecessary data: duplicate font descriptors across pages, embedded thumbnails (preview images of each page), unused objects left from editing, and metadata streams. Removing these reduces size without affecting visual quality.

Lossy Compression Methods

Lossy compression achieves much higher compression ratios by sacrificing some quality. The original data cannot be perfectly reconstructed, but the difference may be imperceptible.

Image Downsampling

The single biggest size reduction usually comes from optimizing embedded images. Many PDFs contain images at 300-600 DPI, but screen viewing only requires 72-150 DPI. Downsampling reduces pixel count, dramatically shrinking file size. Common resampling algorithms include:

  • Average Downsampling: Averages pixel blocks. Fast but can produce soft results.
  • Bicubic Downsampling: Uses weighted averages of surrounding pixels. Better quality, standard choice.
  • Subsampling: Simply picks one pixel per block. Fastest but lowest quality.

Image Recompression

Even without changing resolution, images can be recompressed more aggressively. JPEG quality can be reduced from 95 to 75 with minimal visible difference. For documents destined for screen viewing, quality settings of 60-75 often produce acceptable results at a fraction of the original size.

Mixed Raster Content (MRC)

MRC is an advanced technique used in scanned documents. It separates a page into layers: a high-resolution binary mask for text, a lower-resolution background layer, and a foreground color layer. Each layer is compressed independently using the optimal algorithm for its content type. This can achieve 5-10x better compression than treating the page as a single image.

Choosing the Right Strategy

For archival or legal documents, use lossless methods only. For email attachments and web distribution, combine lossless stream compression with moderate image downsampling. For scanned documents, MRC or aggressive image recompression provides the best results.

The ideal approach often combines multiple techniques: subset fonts, compress streams, remove thumbnails, and moderately downsample images. This balanced strategy typically achieves 40-70% size reduction while maintaining excellent visual quality.

Client-Side Compression Advantages

Browser-based PDF compression tools process files locally using WebAssembly, meaning your sensitive documents never leave your device. This is particularly important for financial, legal, and medical PDFs where cloud-based compression services pose privacy and compliance risks.