JWT Token Base64URL Wire Size, Cookie Limit & Bandwidth Calculator

Short answer: a default RS256 token (52-byte header, 420-byte claims, 2048-bit key) is ⌈4·52/3⌉ + ⌈4·420/3⌉ + ⌈4·256/3⌉ + 2 = 974 bytes, and as an Authorization: Bearer line it is 996 bytes: 12.2 % of nginx's default 8k field buffer (the schematic below shows 11.9 % for the token alone). The largest claims payload that still fits in one 8,190-byte header field (the Apache httpd default) is 5,815 bytes with RS256 on a 2048-bit key and 6,007 bytes with ES256 or Ed25519; inside a 4,096-byte cookie it is 2,725 bytes with RS256 and 2,917 with ES256.

Interactive JWT Token Wire Size & 4KB Cookie Limit Calculator

IETF RFC 7519 · RFC 6265
SCENARIO PRESETS:
?Byte length of the JSON header before Base64url encoding (20 to 512, step 4). Decode the first segment of a token and count its bytes.
?Byte length of the JSON claims before Base64url encoding (32 to 8192, step 16). Decode the second segment and count its bytes. The cookie share shown counts the token value only; the cookie name and attributes count against the 4,096 bytes too (RFC 6265 section 6.1).
?Signature algorithm of the issuer: HS256 (HMAC-SHA256) signs 32 raw bytes, ES256 (ECDSA P-256) and Ed25519 64, RS256 and PS256 with an RSA-2048 key 256, RS512 with an RSA-4096 key 512. The RSA signature is as long as the key modulus, so RS512 with a 2048-bit key is also 256 bytes (RFC 7518 section 3.3 only requires 2048 bits or more). The key size sets it.
?Authenticated requests per month, in millions (1 to 5000, step 5), from the API gateway request count.
ENCODED JWT WIRE LENGTH (BASE64URL)
974 Bytes on the wire
SHARE OF THE 4,096-BYTE COOKIE MINIMUM
23.8% of the 4,096-byte cookie minimum (token value only; the cookie name and attributes count too)
MONTHLY HTTP HEADER BANDWIDTH
45.36 GiB/month header bandwidth (upper bound: assumes the full token on every call; HPACK/QPACK can index a repeated header on one connection)
ED25519 TOKEN VS SELECTED ALGORITHM
Selected token: 974 B · Ed25519 token: 718 B · delta (selected − Ed25519) +256 B/req
CALC44 · JWT Token Wire Size & 4KB…45.3671897423.8
Computed in your browser

Use the JWT Token Wire Size & 4KB Cookie Limit Calculator to evaluate L_JWT = ⌈4·H/3⌉ + ⌈4·P/3⌉ + ⌈4·S/3⌉ + 2 for OAuth2 / OIDC bearer tokens, NextAuth / Clerk session cookies. With the defaults (Raw JSON Header Size = 52 Bytes, Raw JSON Claims Payload Size = 420 Bytes, Cryptographic Signature Algorithm = RS256 / PS256 / RS512 with RSA-2048 key, 256 B) it returns Encoded JWT wire length (BASE64URL): 974 Bytes on the wire.

Governing equationL_JWT = ⌈4·H/3⌉ + ⌈4·P/3⌉ + ⌈4·S/3⌉ + 2 (IETF RFC 7519 (JWT), RFC 7515 (Base64url) and RFC 6265 section 6.1)

Computed in your browser. The calculator, the tables and the worked examples run the same equations.

How Large Can the Claims Be Before a Bearer Token Hits a Header Limit?

A server rejects a request when one header field, or the headers as a whole, pass its limit. This table starts from the byte count of the equation above and asks the opposite question: for each limit that the server vendor documents, how many bytes of claims fit. The bearer line is Authorization: Bearer (22 bytes; the scheme is defined in RFC 6750 section 2.1) plus the token, with the 52-byte header of the calculator default. The cookie row counts the whole Set-Cookie string for a cookie named session with the attributes Path=/, Secure, HttpOnly and SameSite=Lax, which is 48 bytes before the token: RFC 6265 section 6.1 measures name, value and attributes together but does not spell out how to count the separators, so the 48 is a declared assumption, not a figure from the RFC. The three limits that cover the whole request (Tomcat, Node.js and the load balancer total) are shared with every other header, so only the share used by the token is meaningful there.

Largest JWT claims payload (bytes) under each documented limit, 52-byte header; default token share = 996-byte Bearer line (1,022-byte cookie string) ÷ limit · limits read on December 1, 2026
Limit (source)ScopeBytesDefault token shareHS256ES256 / Ed25519RS256 2048-bitRS256 4096-bit
RFC 6265 section 6.1, cookieone cookie4,09625.0 %2,9492,9172,7252,469
Apache httpd LimitRequestFieldSizeone header field8,19012.2 %6,0396,0075,8155,559
nginx large_client_header_buffersone header field8,19212.2 %6,0416,0095,8175,561
AWS Application Load Balancer single headerone header field16,3846.1 %12,18512,15311,96111,705
Apache Tomcat 10.1 maxHttpRequestHeaderSizerequest line + all headers8,19212.2 %sharedsharedsharedshared
Node.js maxHeaderSizeall request headers16,3846.1 %sharedsharedsharedshared
AWS Application Load Balancer entire requestall request headers65,5361.5 %sharedsharedsharedshared

Three things follow. HTTP itself sets no limit: RFC 9110 section 5.4 says it places no predefined limit on the length of a field line, a field value or the header section, so every number above belongs to the server you run, and the nginx and AWS figures are written as 8k and 16 K in their documents (read here as 8,192 and 16,384 bytes). The cookie is the tightest place: with the same RS256 key a claims payload above 2,725 bytes no longer fits in 4,096 bytes, whereas the same token fits in an 8,190-byte header field up to 5,815 bytes. And the algorithm moves the ceiling by a fixed amount: the 256-byte difference between an RS256 and an ES256 signature on the wire is exactly 192 bytes of claims (6,007 against 5,815 bytes in the 8,190-byte row).

At 996 bytes the default token line uses 12.2 % of Tomcat's 8,192-byte request header budget and 6.1 % of Node.js's 16,384-byte default before any other header is counted. A service that verifies a signature on every inbound request spends that time inside each request: it belongs to the mean job duration W of the Webhook Queue & Worker Concurrency Calculator.

What Fixes the Signature Length of Each JWT Algorithm?

The signature segment is the only part of the token that the algorithm sets, and each specification fixes its size. Base64url then expands every 3 bytes to 4 characters with no padding (RFC 7515 section 2), so a 64-byte signature takes 86 characters and a 256-byte one takes 342. The token column uses the same 52-byte header and 420-byte claims as the calculator default.

What fixes the signature length of each JWT algorithm, and the token it gives with a 52-byte header and 420-byte claims, from L = ⌈4H/3⌉ + ⌈4·P/3⌉ + ⌈4·S/3⌉ + 2 · specifications read on December 1, 2026
AlgorithmWhy the signature has this lengthRaw signature (bytes)Base64url (characters)Token (bytes)Authorization: Bearer line (bytes)
HS256The HMAC output is the signature, and HS256 uses SHA-256, a 256-bit hash (RFC 7518 section 3.2)3243675697
ES256R and S are 32 octets each and are concatenated into a 64-octet signature (RFC 7518 section 3.4)6486718740
EdDSA (Ed25519)Ed25519 signatures are 64 bytes (RFC 8032 section 1); JOSE applies Ed25519 with alg EdDSA (RFC 8037 section 3.1)6486718740
RS256, RSA-2048An RSA signature has as many octets as the key modulus (RFC 8017 section 8.2.1); RFC 7518 section 3.3 requires a key of 2048 bits or larger256342974996
RS256, RSA-4096The same rule with a 4096-bit modulus: 512 octets5126831,3151,337

Moving the default token from RS256 with a 2048-bit key to ES256 or Ed25519 removes 256 bytes from every request. At 50 million calls a month that is about 11.9 GiB less header traffic (256 × 50,000,000 / 1,024³).

Why Large JWTs Break Cookies and Add Bytes to Every Request

JSON Web Tokens (RFC 7519) let services check claims without a session lookup. The cost appears when teams place long permission lists in the token. The token then travels with every request, and a cookie larger than the size browsers are expected to support can be dropped. RFC 6265 section 6.1 says user agents should support at least 4,096 bytes per cookie, measured across the name, value and attributes together (rfc-editor.org/rfc/rfc6265).

A JWT is a sequence of URL-safe parts separated by periods, each encoded in Base64url (rfc-editor.org/rfc/rfc7519). Base64url maps every 3 bytes to 4 characters and omits trailing padding (rfc-editor.org/rfc/rfc7515, section 2). Each segment therefore has length ceil(4n / 3), where n is its raw byte count.

JWT Encoded Wire Size & Share of the 4,096-Byte Cookie Minimum by Payload Size (RS256 vs EdDSA/ES256) — Computed via L_JWT = ⌈4·H/3⌉ + ⌈4·P/3⌉ + ⌈4·S/3⌉ + 2 (IETF RFC 7519 (JWT), RFC 7515 (Base64url) and RFC 6265 section 6.1) · Sources checked November 2026
Raw JSON PayloadRS256 JWT (Bytes)RS256 Cookie (%)EdDSA/ES256 (Bytes)EdDSA Cookie (%)50M Calls Bandwidth (RS256)
120 Bytes574 B14.0%318 B7.8%26.73 GiB
250 Bytes748 B18.3%492 B12.0%34.83 GiB
420 Bytes974 B23.8%718 B17.5%45.36 GiB
800 Bytes1481 B36.2%1225 B29.9%68.96 GiB
1500 Bytes2414 B58.9%2158 B52.7%112.41 GiB
2600 Bytes3881 B94.8%3625 B88.5%180.72 GiB

How Is the Default 974-Byte Token Counted?

The wire length is L = ceil(4H / 3) + ceil(4P / 3) + ceil(4S / 3) + 2, where H, P and S are the raw header, claims and signature bytes, and the 2 counts the periods. The default RS256 token has a 52-byte header, 420-byte claims and a 256-byte signature: 70 + 560 + 342 + 2 = 974 bytes. The cookie percentage divides that length by 4,096 and counts the token value only. RFC 6265 section 6.1 measures the 4,096 bytes over the cookie's name, value and attributes, so the name and attributes (for example a 40-byte extra would take the default 23.8 % to 24.8 %) leave a smaller margin than the percentage shown.

The signature length depends on the algorithm: 32 raw bytes for HS256, 64 for ES256 and Ed25519, 256 for RS256 and PS256 with a 2048-bit RSA key, and 512 for RS512 with a 4096-bit key. An RSA signature is as long as its key, so RS512 with a 2048-bit key is also 256 bytes: RFC 7518 section 3.3 requires keys of 2048 bits or more for RS256, RS384 and RS512, so the hash name does not set the length. Switching the default token from RS256 to Ed25519 saves 256 bytes on the wire, from 974 to 718 bytes. The card compares the selected algorithm with Ed25519 and shows the delta as selected minus Ed25519, so HS256 reads -43 bytes: its 675-byte token is smaller than the 718-byte Ed25519 token. Bytes multiply with volume: 974 bytes across 50 million calls a month is 45.36 GiB of header traffic.

Cryptographic Signature Overhead Comparison (RFC 7518 JWA Algorithms, 420B Payload) — Computed via L_JWT = ⌈4·H/3⌉ + ⌈4·P/3⌉ + ⌈4·S/3⌉ + 2 (IETF RFC 7519 (JWT), RFC 7515 (Base64url) and RFC 6265 section 6.1) · Sources checked November 2026
JWA AlgorithmRaw SignatureBase64URL SignatureTotal JWT LengthCookie Budget Used
HS256 (HMAC-SHA256)32 B43 B675 B16.5%
EdDSA (Ed25519)64 B86 B718 B17.5%
ES256 (ECDSA P-256)64 B86 B718 B17.5%
RS256 with RSA-2048 key (256 B)256 B342 B974 B23.8%
RS512 with RSA-2048 key (256 B)256 B342 B974 B23.8%
RS512 with RSA-4096 key (512 B)512 B683 B1315 B32.1%

What Do a Partner API Gateway and a Role-Heavy Web App Pay for Their Tokens?

A gateway that signs with a 4096-bit RSA key. The gateway issues RS512 tokens with 800 bytes of claims and serves 100 million authenticated calls a month. Each token is 1,822 bytes, 44.5 % of the 4,096-byte cookie minimum, and the header traffic adds up to 169.69 GiB a month. The same claims signed with Ed25519 would be 1,225 bytes, so the 4096-bit key costs 597 bytes on every call: the decision is whether that key size is worth 597 bytes per request. Related in the Cloud, API, LLM & Automation Hub: API Rate Limit, Token Bucket & Backoff Calculator (the token is sent on every rate-limited call) and Cloud Egress Bandwidth Cost Calculator (AWS vs R2) (header bytes add to the traffic you pay for).

A web app that puts the role list in the token. The app stores 2,600 bytes of role and permission claims in an RS256 token with a 2048-bit key and serves 200 million calls a month. The token is 3,881 bytes: 94.8 % of 4,096 bytes and 722.89 GiB of header traffic a month. Switching to Ed25519 gives 3,625 bytes, only 256 bytes less, because 3,467 of the 3,881 characters are the claims segment (89 %). The signature algorithm cannot fix a claims problem; shrinking the claims can. You can compare these limits with other calculators in the Engineering Studio.

How Small Do the Claims Need to Be?

Keep claims small and move permissions out of the token. A 2,600-byte claims payload on an RS256 token is 3,881 bytes, which uses 94.8% of the 4,096-byte budget and 722.89 GiB of header traffic a month at 200 million calls; with the 48-byte cookie string of the table above it is 3,929 bytes, still under 4,096 but with 2,725 bytes of claims as the ceiling. The same token with Ed25519 would be 3,625 bytes. Carry a short identifier or a permission-version key instead, and let the service resolve the permissions from a cache.

Sources

  1. IETF RFC 7519 · JSON Web Token (JWT)A JWT is a sequence of URL-safe parts separated by period characters, each Base64url-encoded. Basis of the three-segment structure and the two period bytes.
  2. IETF RFC 7515 · JSON Web Signature, section 2Base64url uses the URL- and filename-safe alphabet with trailing = characters omitted. Basis of the ceil(4n/3) expansion per segment.
  3. IETF RFC 6265 · HTTP State Management Mechanism, section 6.1User agents should support at least 4096 bytes per cookie, measured as name, value and attributes together. Basis of the 4,096-byte reference. The calculator measures the JWT alone, so its margin is optimistic.
  4. IETF RFC 7541 · HPACK header compression for HTTP/2An indexed representation can replace a repeated header field with a reference to a dynamic table entry. Basis of the note that the header bandwidth is an upper bound.
  5. IETF RFC 7518 · JSON Web Algorithms, sections 3.2 to 3.4 PrimaryKey and signature rules for HS256 (3.2), RS256 (3.3, key of 2048 bits or larger) and ES256 (3.4, a 64-octet signature of R and S). Read December 1, 2026.
  6. IETF RFC 8037 · CFRG curves in JOSE, section 3.1 PrimaryAlgorithm EdDSA applies RFC 8032 signing to the JWS Signing Input. Read December 1, 2026.
  7. IETF RFC 8032 · EdDSA, section 1 PrimaryEd25519 and Ed448 signatures are 64 and 114 bytes. Read December 1, 2026.
  8. IETF RFC 8017 · PKCS #1 v2.2, section 8.2.1 PrimaryThe RSASSA-PKCS1-v1_5 signature is an octet string whose length is that of the RSA modulus. Read December 1, 2026.
  9. IETF RFC 6750 · Bearer Token Usage, section 2.1 PrimaryThe Authorization header carries the scheme Bearer, one space and the token. Basis of the 22-byte prefix. Read December 1, 2026.
  10. IETF RFC 9110 · HTTP Semantics, section 5.4 PrimaryHTTP places no predefined limit on the length of a field line or of the header section; servers choose their own. Read December 1, 2026.
  11. nginx · large_client_header_buffers PrimaryDefault 4 8k; a request header field cannot exceed the size of one buffer, or nginx answers 400. Read December 1, 2026.
  12. Apache httpd 2.4 · LimitRequestFieldSize PrimaryDefault 8190 bytes for one request header field. Read December 1, 2026.
  13. Apache Tomcat 10.1 · HTTP connector, maxHttpRequestHeaderSize PrimaryDefault 8192 bytes (inherited from maxHttpHeaderSize) for the request line and all headers, counting line terminators and whitespace. Read December 1, 2026.
  14. Node.js · http.maxHeaderSize and the maxHeaderSize server option PrimaryDefault 16384 bytes (16 KiB) for the request headers. Read December 1, 2026.
  15. AWS · Quotas for your Application Load Balancers, HTTP headers PrimaryRequest line 16 K, single header 16 K, entire request header 64 K, none adjustable. The document writes K without defining it; read here as 1,024. Read December 1, 2026.

Method and test suite: Calculation Methodology.

Frequently Asked Questions: JWT Token Wire Size & 4KB Cookie Limit Calculator

Why does the browser drop the cookie without an error?

Browsers may silently reject a cookie that is too large, so check the whole Set-Cookie line, including the name and attributes, against the 4,096-byte guidance, not only the token.

Why not use HS256 across all services?

HS256 uses one shared secret for signing and verification, so any service that can verify a token can also mint one. ES256 and Ed25519 verify with a public key and keep signing in the issuer. The price in the calculator's model is 43 more bytes on the wire than HS256 (86 against 43 for the signature).

Does HTTP compression shrink the token?

Gzip and Brotli do not compress header fields. HTTP/2 HPACK (RFC 7541) and HTTP/3 QPACK can replace a header that repeats on the same connection with a table index, so the bandwidth shown is an upper bound; the first request still carries the token in full.

What is the phantom token pattern?

The browser holds a short opaque token. The gateway exchanges it for a full internal JWT with the permissions, so the large token never leaves the internal network and the browser keeps sending a small value.