---
source: https://iinventedlight.com/library/notes/go-compress-flate.md
title: "Go compress/flate: the DEFLATE compressed data format"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (Go); BSD-3-Clause (Go); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Go, compress/flate package reference; Go, compress/flate source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-24
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-24
as_of: 2026-11-24
confidence: medium
untested: "Not reproduced (2026-11-24). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go-compress-flate"
tags: [go, flate, deflate, compression, rfc-1951]
client: Librarian
sources:
  - id: S1
    title: "compress/flate package reference"
    publisher: Go
    url: https://pkg.go.dev/compress/flate
    accessed: 2026-11-24
    license: "BSD-3-Clause"
  - id: S2
    title: "compress/flate source"
    publisher: Go
    url: https://go.dev/src/compress/flate/deflate.go
    accessed: 2026-11-24
    license: "BSD-3-Clause"
---
# Go compress/flate: the DEFLATE compressed data format
**Answer:** Package flate implements the DEFLATE compressed data format.

## Compression levels

The format is described in RFC 1951.

BestSpeed is 1.

BestCompression is 9.

DefaultCompression is -1.

HuffmanOnly disables Lempel-Ziv match searching.

It only performs Huffman entropy encoding.

A preset dictionary can be used to improve the compression ratio.

## Related packages

The compress/gzip and compress/zlib packages implement access to DEFLATE-based file formats.

## See also

- [go-compress-zlib](https://iinventedlight.com/library/notes/go-compress-zlib/)
- [go-compress-gzip](https://iinventedlight.com/library/notes/go-compress-gzip/)
- [go-archive-zip](https://iinventedlight.com/library/notes/go-archive-zip/)

## Claims

- id: C1
  claim: The package implements the DEFLATE compressed data format in RFC 1951.
  source: S1
  evidence: "Package flate implements the DEFLATE compressed data format"

- id: C2
  claim: The gzip and zlib packages implement access to DEFLATE-based file formats.
  source: S1
  evidence: "packages implement access to DEFLATE-based file formats"

- id: C3
  claim: BestCompression is 9.
  source: S1
  evidence: "BestCompression = 9"

- id: C4
  claim: HuffmanOnly disables Lempel-Ziv match searching.
  source: S2
  evidence: "HuffmanOnly disables Lempel-Ziv match searching"

## Sources

- [S1] compress/flate package reference. Go. https://pkg.go.dev/compress/flate . License: BSD-3-Clause. Accessed 2026-11-24.

- [S2] compress/flate source. Go. https://go.dev/src/compress/flate/deflate.go . License: BSD-3-Clause. Accessed 2026-11-24.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go, compress/flate package reference; Go, compress/flate source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
