Flate compression (PDF filter name: FlateDecode) uses the DEFLATE algorithm to losslessly compress repetitive data streams inside PDF files. A 10 MB text stream compresses down to 1–2 MB. Every word, vector path, and font glyph is reproduced identically on decompression. It has been supported by every PDF viewer since 1996, making it the universally safe choice for all non-image PDF data.
What Is Flate Compression?
PDF page content is stored as a stream of drawing commands — "move to X, draw text in font F1, set color to black." A 500-page document generates enormous amounts of this repetitive code. Without compression, a typical text-heavy PDF would be 5–10× larger than necessary.
Flate compression, identified as the FlateDecode filter in the PDF spec, solves this by applying the DEFLATE algorithm before storing the stream. DEFLATE replaces repeated patterns with back-reference pointers — since "BT /F1 12 Tf" appears thousands of times per document, most occurrences become 2-byte pointers instead of 12-byte sequences, yielding dramatic size reductions.
Because it is lossless, every byte is reproduced exactly. This makes it safe for text, vector graphics, font programs, and any structured data where precision is mandatory.
Same tech as ZIP files: FlateDecode uses the zlib library — the same code inside .zip, .gz, PNG, and HTTP gzip. If your system can unzip a file, it already has a Flate decoder.
How FlateDecode Works
- LZ77 back-referencing. The encoder scans forward and replaces recurrences of previously seen byte sequences with compact (distance, length) pointers. In a PDF stream, common operator sequences shrink from 10+ bytes to 2–3 byte references.
- Huffman coding. The resulting stream of literals and pointers is compressed again with Huffman coding — shorter codes for more frequent values — cutting size further.
- zlib wrapping. PDF uses the zlib wrapper: a 2-byte header and Adler-32 checksum for integrity verification.
- Stored as a PDF stream. The result sits in the PDF with
/Filter /FlateDecode. The viewer decompresses on demand when rendering.
5 0 obj << /Length 1847 % compressed size /Filter /FlateDecode % zlib/DEFLATE >> stream ... 1847 bytes of compressed binary ... endstream endobj % Decoded result: % BT /F1 12 Tf 72 720 Td (Hello, World!) Tj ET
What Data Uses FlateDecode?
| PDF Data Type | Uses FlateDecode | Typical Reduction |
|---|---|---|
| Page content streams | ✓ Always | 70–90% |
| Font data | ✓ Always | 60–80% |
| Cross-reference streams (PDF 1.5+) | ✓ Always | 80–95% |
| XMP metadata | ✓ Often | 75–85% |
| ICC color profiles | ✓ Often | 50–70% |
| Raster images (photos) | ✗ Rarely | Poor — use JPEG/JPX |
Real-World Examples
500-Page Contract Delivered to a Client
A corporate lawyer exports a 500-page contract to PDF. The raw page content streams occupy about 10 MB. After FlateDecode compression, the delivered file is 1.2 MB. The client's viewer decompresses each page stream in milliseconds. Every comma and paragraph indentation is reproduced perfectly because the algorithm is lossless.
Vector Logo for High-Resolution Print
A designer exports a logo built from vector paths to PDF. The coordinate data compresses extremely well with FlateDecode — highly repetitive path operators shrink by over 80%. The final PDF is under 50 KB. At 10,000% zoom on a press, lines remain mathematically perfect.
Annual Report with Charts and Text
A 100-page annual report with vector charts and dense text generates 22 MB of raw content streams. After FlateDecode, the PDF is 2.8 MB — small enough to attach to an email. The vector charts remain perfectly sharp at any zoom level on any screen.
Why Flate Is the King of PDF Compression
Universal Support
Every PDF viewer — desktop, mobile, web, embedded — supports FlateDecode. In the spec since PDF 1.2 (1996).
Completely Lossless
Not a byte changes. Essential for text, vector paths, fonts, and forms where corrupted data is unacceptable.
Fast Encode & Decode
Modern CPUs decompress FlateDecode in microseconds. Pages open instantly even on mobile and embedded readers.
Excellent Ratios on Text
Reduces text/vector data by 70–90%. A 10 MB raw stream becomes a 1–2 MB compressed stream in the PDF.
Free and Patent-Free
DEFLATE is unencumbered by patents. zlib is open-source and pre-installed on virtually every OS.
Stackable with Predictors
FlateDecode can be combined with predictor filters (PNG-style predictors) for even better compression on structured image data.
Flate vs. Other PDF Compression Filters
| Filter | PDF Name | Lossless? | Best For |
|---|---|---|---|
| Flate (DEFLATE) | FlateDecode | ✓ Always | Text, vectors, fonts, metadata |
| JPEG | DCTDecode | ✗ Lossy | Color photographs |
| JPEG 2000 | JPXDecode | Optional | High-quality color images |
| CCITT Group 4 | CCITTFaxDecode | ✓ Always | Black-and-white scanned pages |
| JBIG2 | JBIG2Decode | Optional | B&W text (smallest size) |
Never use Flate on photographs. Applying FlateDecode to a raster photo produces a file much larger than JPEG. Professional PDF tools automatically route images to DCT/JPX and text/vector to FlateDecode.
Common Mistakes to Avoid
- Applying Flate to raster images. FlateDecode is terrible at compressing photographic data. A JPEG photo stored with FlateDecode instead of DCTDecode could be 10–50× larger. Use the correct filter for each content type.
- Skipping compression entirely. Some PDF generators save streams uncompressed. Always verify that your tool applies FlateDecode to content streams and fonts.
- Double-compressing with HTTP gzip. FlateDecode PDFs wrapped in gzip HTTP transfer see almost no additional reduction but waste CPU. One layer per stream is sufficient.
- Not running PDF optimization after editing. Each incremental edit can add new, uncompressed streams. Run "Optimize PDF" or "Save As" periodically to recompress all streams.
- Assuming all PDF export tools use Flate. Some low-quality converters skip stream compression entirely. Check your generated PDF's file size — if it seems unusually large, the streams may be uncompressed.
Frequently Asked Questions
Flate compression (
FlateDecode) is a lossless filter in PDF using DEFLATE — the same tech as ZIP and PNG — to compress text streams, fonts, and vector graphics by 70–90% with zero data loss.FlateDecodeis the PDF spec's filter name for Flate. When a viewer sees/Filter /FlateDecode, it decompresses the stream data with zlib before rendering.Yes, always. FlateDecode decompression produces byte-for-byte identical output — no information is lost.
Page content streams, font data, cross-reference streams, XMP metadata, and ICC color profiles. Raster images use JPEG, JPEG 2000, or CCITT instead.
Typically 70–90% for text and vector data. A 10 MB raw stream often compresses to 1–2 MB. Compression ratio depends on data repetitiveness.
Flate is lossless and for text/vectors. JPEG is lossy and for photos. Using Flate on photos makes enormous files; JPEG on text makes blurry letters. Professional tools use both together.
Compress Your PDF — Free
PDFlyst optimizes your PDF's compression streams to shrink file size without sacrificing quality.
Compress PDF — Free