$linuxjunkies
>

HPACK

also: HTTP/2 Header Compression

HPACK is a header compression algorithm used in HTTP/2 that reduces the size of HTTP headers by maintaining a dynamic table of previously sent header fields and using Huffman encoding.

HPACK (HTTP/2 Header Compression) is a compression scheme specifically designed for HTTP/2 that dramatically reduces header overhead in web communications. Traditional HTTP/1.1 sends headers in plain text with minimal compression, but HTTP/2 uses HPACK to encode headers more efficiently.

HPACK works by maintaining a dynamic table on both client and server that stores recently transmitted header fields. When a header is sent again, only a reference to the table entry is transmitted instead of the full header name and value. For example, the header Content-Type: application/json might be referenced as a single byte rather than 26 bytes.

The algorithm also uses Huffman encoding, a variable-length prefix code that represents frequently-used characters (like common HTTP header values) with fewer bits. This combination typically reduces header size by 50-90% compared to uncompressed headers, significantly improving HTTP/2 performance, especially on high-latency or bandwidth-constrained networks.

Related terms