Project Nayuki

Simple DEFLATE decompressor


This project is a clear implementation of an inflater for the DEFLATE compression format in less than 1000 lines of well-commented code, suitable as a reference for educational purposes. It is provided in Java, and is open source. The code can be used for study, and as a solid basis for modification and extension. Consequently, the codebase optimizes for readability and avoids fancy logic, and does not target the best speed/memory/performance.

The DEFLATE format is a compression standard specified in RFC 1951 (plain text or PDF) in year 1996. The format has widespread use, and can be found in protocols and file formats such as ZIP, gzip, PNG, HTTP, and Git. The gzip container format is specified in RFC 1952 (plain text or PDF).

Source code

Browse the project’s source code at GitHub:

Or download a ZIP of all the files:

The project package includes these main items:


DEFLATE is popular enough that essentially every important programming language has a library for it. For example, Java has, Python has zlib, and zlib is available for C. While this project provides a compliant implementation, my code runs slowly so it should be used as an educational tool only.

More info