Skip to main content
HTTP/2

HTTP/2

Active

Binary-framed version of HTTP that multiplexes multiple requests over a single TCP connection, compresses headers with HPACK, and eliminates head-of-line blocking at the application layer. Supersedes HTTP/1.1 for all modern web traffic.

WebRFC 91132015BinaryMultiplexing
Error CodesHPACK

In one line

HTTP/2 (RFC 9113) is the binary successor to HTTP/1.1. It multiplexes multiple streams over a single TCP connection, compresses headers with HPACK (85-90% reduction), and eliminates application-layer head-of-line blocking. The HTTP semantics – methods, headers, status codes – are unchanged. Only the wire format changed. HTTP/2 is used by over 60% of websites as of 2026.

Quick Reference

FieldSizeDescription
Length3 bytesFrame payload length in bytes (max 16,384 by default, up to 16,777,215 negotiated)
Type1 byteFrame type: DATA (0x0), HEADERS (0x1), PRIORITY (0x2), RST_STREAM (0x3), SETTINGS (0x4), PUSH_PROMISE (0x5), PING (0x6), GOAWAY (0x7), WINDOW_UPDATE (0x8), CONTINUATION (0x9)
Flags1 byteType-specific flags: END_STREAM (0x1), END_HEADERS (0x4), PADDED (0x8), PRIORITY (0x20)
Stream ID4 bytes31-bit stream identifier. 0 = connection-level. Client uses odd IDs (1, 3, 5...), server uses even (2, 4, 6...)
PayloadVariableFrame type-specific payload. HEADERS frame contains HPACK-compressed header block.

Key Characteristics

Multiplexing

Multiple streams share one TCP connection. No head-of-line blocking at HTTP layer. 100+ concurrent streams on one connection.

HPACK compression

Header compression via static table (61 common headers) and dynamic table. 85-90% reduction in header bytes for typical API traffic.

Binary framing

All communication is length-prefixed binary frames. No text parsing, no ambiguous line endings. Lower parsing overhead than HTTP/1.1.

TLS in practice

HTTP/2 over cleartext is defined (h2c) but all browsers require TLS (h2). Negotiated via ALPN extension during TLS handshake.

Message Format

Request
http
// HTTP/2 binary frame (hex notation)
// HEADERS frame for GET /api/users

00 00 21  // Length: 33 bytes
01        // Type: HEADERS (0x1)
05        // Flags: END_STREAM | END_HEADERS
00 00 00 01 // Stream ID: 1

// HPACK-compressed header block:
82        // :method: GET  (static table index 2)
86        // :scheme: https (static table index 6)
44 0f 2f 61 70 69 2f 75 73 65 72 73  // :path: /api/users
7a 86 c5 a0 e4 1d 34 7a  // :authority: api.example.com (huffman)

// Human-readable equivalent:
:method: GET
:path: /api/users
:scheme: https
:authority: api.example.com
Response
http
// HTTP/2 HEADERS frame (response)
00 00 14  // Length: 20 bytes
01        // Type: HEADERS
04        // Flags: END_HEADERS
00 00 00 01 // Stream ID: 1 (same stream)

// HPACK-compressed headers:
88        // :status: 200 (static table index 8)
5f 1d 86 a8 eb 10 64 9c bf  // content-type: application/json
5f 0d 89  // content-length: 1234

// DATA frame follows:
00 00 d2  // Length: 210 bytes
00        // Type: DATA (0x0)
01        // Flags: END_STREAM
00 00 00 01 // Stream ID: 1
5b 7b 22 69 64 22 3a 31 ...  // JSON payload

Implementations

linuxsince nginx 1.9.5+, Apache 2.4.17+, Node.js 8.4+built-in
macossince Safari, Chrome, Firefox – all major browsersbuilt-in
windowssince IIS 10, Chrome, Firefox, Edgebuilt-in
iossince iOS 9+ (NSURLSession)built-in
androidsince Android 5.0+ (OkHttp 3+)built-in