Show HN: Deflate X-Ray, See inside a compressed file

Hacker News Top Tools

Summary

Deflate X-Ray is a single-page web tool that decompresses DEFLATE streams (gzip, zlib, PNG, ZIP) in-browser and visualizes every byte's bit cost, back-references, and block structure. Built from scratch following RFC 1951, the 45 KB page runs entirely client-side with no network requests.

No content available
Original Article
View Cached Full Text

Cached at: 11/22/26, 09:26 PM

# deflate x-ray Source: [https://hrih.si/projects/deflate-xray/](https://hrih.si/projects/deflate-xray/) ## What it is Almost every compressed file, from`\.zip`and`\.png`to`\.gz`and most web pages, uses the same method, DEFLATE\. When text repeats, it’s replaced with a short pointer back to where it appeared before:*copy 41 bytes from 57 back*\. Letters that come up often get shorter codes than rare ones\. A normal decompressor hands you only the result\. deflate x\-ray takes the file apart with its own decompressor, written from scratch, and shows you every pointer and what each byte cost\. ## What you can see - **What each letter cost\.**Every byte is colored by its cost in bits\. A letter stored as itself costs several bits\. Inside a long copy it costs a fraction of one\. The cheap repeats fade and the expensive surprises glow\. - **Where each piece came from\.**Click any byte to see the pointer that wrote it, its raw bits, and an arc back to the text it copied\. - **How deep the copying goes\.**In*The House That Jack Built*each verse copies the one before: copies of copies, 11 generations deep\. A smooth PNG gradient goes 150 deep\. - **Where the bits went\.**How many went to letters, pointers and headers, with the file’s checksum checked against what came out\. ## Your files stay with you Type anything, and your browser compresses it with its own built\-in DEFLATE, so you see what a real compressor chose\. Or drop a`\.gz`,`\.zlib`,`\.png`or`\.zip`file on the page\. The page reads it in your browser\. There’s no upload and no server involved: the page makes no network requests at all\. ## How it works The decompressor follows RFC 1951 and is built like zlib’s reference decoder,*puff*\. It handles all three block types and finds the DEFLATE stream inside gzip, zlib, PNG and ZIP files\. One test checks that the headers, pointers and end\-of\-block codes add up to exactly the number of bits in the stream, for every block type\. The whole viewer is one 45 KB page\. ## Honest limits - It paints the first 150,000 bytes of a stream\. The statistics cover all of it\. - Only the first member of a multi\-member gzip file is traced\. - ZIP64, encrypted ZIP entries and zlib preset dictionaries aren’t supported\. - Bytes outside printable ASCII, including accented letters, show as`·`\. ## How it was made This is one of my nightly builds: an AI agent invents, builds and tests a new project every night\. deflate x\-ray came out of the 15 October 2026 run\. [Have a related idea? Say hello](https://hrih.si/contact/)

Similar Articles

Let's build a compressor from scratch

Lobsters Hottest

This article provides a tutorial on file compression, explaining the basics of Huffman coding and DEFLATE algorithms, and includes an interactive playground for hands-on learning.

Hellishly Slow Level 13 Deflate Compression

Hacker News Top

The article describes libdeflate's new level 13, a deliberately slow DEFLATE compression level that achieves marginally better compression (0.134% on Silesia) at the cost of being 56x slower than level 12, designed for scenarios where data is compressed once and decompressed many times.

ZXC: Lossless compression built for ultra-fast decode

Lobsters Hottest

ZXC 0.15.0 正式发布,这是一款面向“一次压缩、多次解压”场景的无损压缩库 libzxc,采用 C 编写,解压速度可达每秒数 GB,其各级别的解码速度均为 LZ4 的 1.5–2.8 倍,且输出体积相等或更小。

Nibnib: Image compression with extreme decompression speed

Hacker News Top

Nibnib is an open-source image compression format and Rust tool tuned for extreme decompression speed, originally designed for DVI output on the RP2350 microcontroller, achieving 4bpp compression by decoding two 16bpp pixels from a single palette-lookup byte.