Search for a tool
Deflate Compression

Tool for easily analyzing, compressing, and decompressing files with the Deflate format (RFC 1950). Reduce data size for storage and web transfer with Deflate compression.

Results

Deflate Compression -

Tag(s) : Compression

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Deflate Compression' tool for free! Thank you!

Deflate Compression

Deflate Decompressor

Loading...
(if this message do not disappear, try to refresh this page)

Metadata Parser

Deflate Compressor

Loading...
(if this message do not disappear, try to refresh this page)


Answers to Questions (FAQ)

What is Deflate? (Definition)

Deflate (sometimes spelled DEFLATE or Flate) is a lossless data compression algorithm that has become a universal standard.

Its principle combines two techniques: the LZ77 algorithm to identify and eliminate redundancies, followed by Huffman coding to represent the data more compactly.

Formally described in RFC 1951, it is the cornerstone of ubiquitous formats such as ZIP, PNG, and HTTP compression.

How does compression with Deflate work?

Deflate compression is performed in three sequential steps:

— LZ77 analysis (sliding window): Examine the data with a search buffer to identify repeating character sequences. Replace these sequences with a short reference (a distance and a length) pointing to their first occurrence.

Example: To compress DECODEAVECDCODE, scan the sentence and find repetitions like CODE, which appears twice. LZ77 replaces it with a reference: (distance=9, length=4). The intermediate stream becomes: D,E,C,O,D,E,A,V,E,C,(10-4)

Huffman coding: Compress the output of the LZ77 step (raw characters, lengths, and distances) a second time by assigning binary codes of varying lengths. The most frequent symbols receive the shortest codes.

Example: Count the frequency of symbols in this new stream. E, D, and C are the most frequent (E could become 01, D -> 100, etc.), and longer codes are associated with the others.

— Block structuring: Organize everything into a series of compressed data blocks. Each block has a header indicating the type of Huffman coding used (static, dynamic, or uncompressed).

How does decompression with Deflate work?

Decompression is the reverse process of compression, and Deflate makes it very efficient:

— Read the block header to determine how the data is encoded (specifically, the Huffman table type).

— Reconstruct the Huffman trees (if the block uses dynamic tables) from the information stored in the stream.

— Read and decode the data stream: Use the Huffman trees to convert the bits into symbol sequences (raw characters, lengths, and distances).

— Apply LZ77 in reverse: For each reference (distance, length) read, copy the corresponding sequence from the already decompressed data (the output buffer) to reconstruct the original file.

What are the three types of blocks in a Deflate stream?

Uncompressed block (BTYPE=00): The data is stored as is, with some padding to fit the bytes. Useful when a data segment is already compressed or random (and therefore incompressible).

Compressed block with static Huffman tables (BTYPE=01): Uses predefined Huffman trees optimized for generic text data. Saves space by not having to transmit the tables.

Compressed block with dynamic Huffman tables (BTYPE=10): Transmits Huffman trees optimized specifically for the block data just before the data. This is the most flexible and generally offers the best compression.

What is the difference between Deflate, Zlib and GZIP?

It is crucial to distinguish the compression algorithm from its packaging:

Deflate (RFC 1951): This is the raw compression algorithm, the data itself.

Zlib (RFC 1950): This is a lightweight packaging format designed for in-memory data streams. It adds a small header and an Adler-32 checksum to verify the integrity of the compressed data.

GZIP (RFC 1952): This is a more comprehensive file format, designed for compressing individual files. It adds a header containing the original file name and timestamp, and uses a more robust CRC-32 checksum to verify the integrity of the original data after decompression.

In summary: GZIP and Zlib both use the Deflate algorithm to compress the core data, but they package it differently depending on the intended use.

How to recognize a Deflate stream? (Identification)

A raw deflate stream has no universal marker.

Therefore, it's difficult to find the beginning of the stream by searching for the structure of an initial deflate block (the first bits indicate BFINAL and BTYPE).

In practice, you rarely encounter a bare deflate stream. It's almost always encapsulated in a container such as a ZIP or PNG file, or in an HTTP stream.

The simplest approach is therefore to check the header of the container format (ZIP, PNG, etc.), which is easily identifiable.

When was Deflate invented?

Deflate was designed in the early 1990s by Phil Katz to replace the patented algorithms used in early versions of PKZIP.

Its standardization in RFCs dates back to 1996, which largely contributed to its adoption in formats such as ZIP, PNG, HTTP (Content-Encoding: deflate), and others.

Source code

dCode retains ownership of the "Deflate Compression" source code. Any algorithm for the "Deflate Compression" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Deflate Compression" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Deflate Compression" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.

Cite dCode

The content of the page "Deflate Compression" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).

Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).

To cite dCode.fr on another website, use the link: https://www.dcode.fr/deflate-compression

In a scientific article or book, the recommended bibliographic citation is: Deflate Compression on dCode.fr [online website], retrieved on 2025-11-17, https://www.dcode.fr/deflate-compression

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Deflate Compression' tool for free! Thank you!


https://www.dcode.fr/deflate-compression
© 2025 dCode — The ultimate collection of tools for games, math, and puzzles.
â–˛  
Feedback