Summary
- RFC 7541, May 2015, defines HPACK: HTTP/2 header compression built on a fixed static table and a dynamic table the two endpoints maintain in lockstep.
- One table is the entire decoding context: "to decompress header blocks, a decoder only needs to maintain a dynamic table as a decoding context. No other dynamic state is needed."
- Each direction keeps its own table — "the request and response dynamic tables are separate" — which halves the synchronisation problem and removes none of it.
Headers repeat, so compress them
A browser sends the same header names, a handful of changing values and the same fat cookies on every single request. Sending all of it literally, request after request, wastes bytes the request line stopped wasting years ago.
HPACK answers with two tables. The static one ships inside the specification: 61 entries covering the usual header names and a handful of standard values, indexed 1 to 61, free to reference from the first byte of the connection. The dynamic one starts empty at index 62 and fills as the connection runs, with a default ceiling of 4,096 octets and a per-entry charge of name length plus value length plus 32 bytes of overhead.
The table is the only state, which makes it the whole risk
Most compression is a private affair. A gzip stream carries everything its decoder needs; get it wrong and you get garbage, but you get your own garbage. HPACK has no such luxury. An index is a pointer into a table the receiver had to build in the same order, with the same insertions and the same evictions. There is no checksum for "you and I are thinking of different headers."
That is the trade at the heart of it: compression stops being a local convenience and becomes shared mutable protocol state. Once it does, the specification has to pin down insertion, sizing and eviction tightly enough that two independently written implementations cannot drift — because drift is not a performance bug, it is a decoding failure.
Order and eviction as protocol rules
The dynamic table is a queue with a ruler. New entries land at index 62 and everything older shifts up; eviction takes the oldest entry from the far end. The total must stay under the limit the peer advertised, and shrinking that limit evicts immediately, mid-connection, without asking.
None of this is an optimisation detail. It is the protocol. A single divergence does not garble the bytes — the block still parses — it silently swaps one header for another, and every index after the divergence inherits the mistake.
When not to compress
The specification defines literal representations that never enter the dynamic table at all. A header can be sent, used and forgotten without joining the shared history.
That is a security decision wearing an encoding option's clothes. Anything that varies with a secret and gets compressed alongside an attacker's chosen text can be probed by watching the compressed size move. HPACK does not pretend otherwise; it hands implementers a way to keep a header out of the dictionary entirely.
The lesson about compression as state
Compression used to be something you did to your own bytes. In HPACK it is a joint commitment, and the same rules that make it efficient make it brittle.
The general lesson is the one every shared-state protocol relearns: specify the table, the order and the eviction to the byte, and leave a documented way out. Shared dictionaries remember more than their users intend.
It is the discipline that keeps a shared system thin: specify only what must be common, make it verifiable locally, and leave an exit. HPACK's table is small, deterministic and auditable. That is why it works.
Member Briefing
Read the full trend briefing
Members read the full briefing with the source notes behind every finding.
Strategic Circle
A daily briefing in your language, built from changes we have verified.
Join for USD 20/monthCancel anytime.
Members also get the full research library, a daily briefing on the networks they follow and the private forum.






