HTTP Header Size Calculator for Proxy Limits

July 16, 2026

HTTP Header Size Calculator

Estimate request header bytes from cookies, authorization tokens, user agents, and custom fields before a proxy returns 431 Request Header Fields Too Large.

⚙Named Header Scenarios
📥Request Header Inputs
HTTP/2 compresses repeat headers on a warm connection; the first request can still be larger.
35% means repeated request headers are modeled as 35% of raw bytes.
Count the Cookie value itself. The calculator adds the field name and CRLF overhead.
Bearer JWTs, API keys, Basic tokens, or signed client auth strings.
Examples: X-Request-ID, X-Forwarded-For, traceparent, baggage, tenant, locale.
The calculator assumes about 14 bytes of name/colon/space/CRLF overhead per custom field.
Desktop browsers often land around 80-180 bytes; some crawlers and app clients are longer.
Host, Accept, Accept-Language, Accept-Encoding, Connection, method, URL, and CRLF terminator.
Use page views, API calls, or one load-test interval. Results show header-only overhead.
Use the smallest limit across browser, CDN, load balancer, reverse proxy, and app server.
Headers above this limit often fail as 400, 431, 502, or proxy-specific errors.
Reserve space for future cookies, A/B tests, tracing, and intermediary-added headers.
Total Header Bytes 0 raw request bytes
Proxy Limit Usage 0% of configured limit
Extra Bandwidth 0 MB for request count
Proxy Fit OK after safety buffer
Headers fit comfortably under the configured proxy limit.
📊Header Component Snapshot
0%Cookie Share
0%Auth Share
0%Custom Share
0 KBSafe Limit
📏HTTP Header Limit Table
Layer or server Common default What it usually counts Practical warning point
Nginx reverse proxy 8 KB per buffer is common Request line and header fields, depending on buffer directives Keep routine traffic below 5-6 KB unless buffers are deliberately tuned.
Apache HTTP Server 8 KB field size default Individual header field size and request-line constraints Large Cookie or Authorization values should be trimmed before 6 KB.
AWS Application Load Balancer 16 KB request header limit Total request headers handled by the load balancer Start investigating above 12 KB, especially with multiple cookies.
Cloudflare edge 32 KB request header limit Total incoming request headers at the edge Leave room for CDN-added fields and security products.
Envoy / service mesh 60 KB is a common tuned ceiling Aggregated request headers after mesh and tracing additions Trace baggage can grow quickly across internal hops.
Node.js application Often 16 KB in modern runtimes Total parsed HTTP headers before the app receives the request Do not assume the app limit is higher than the proxy limit.
🔀Proxy Comparison Grid
Path example Smallest hop Recommended cap Best fix when exceeded
Browser to Nginx to PHP app Nginx 8 KB 5.5 KB before buffer Reduce Cookie payload and store session state server-side.
Browser to CDN to ALB to app ALB 16 KB 11-12 KB before buffer Audit analytics cookies, feature flags, and JWT length.
Mobile API to gateway to service mesh Gateway policy 8-10 KB if unknown Move large context out of headers into request body or lookup keys.
Internal service to Envoy sidecar Mesh max headers 50% of tuned mesh limit Control tracing baggage and do not forward user cookies internally.
SSO portal behind enterprise proxy Enterprise proxy 6-8 KB unless documented Shorten SSO cookies and split apps onto distinct cookie domains.
🧭Scenario Reference Table
Named scenario Typical header drivers Likely raw size Operational note
Static SiteHost, Accept, User-Agent0.5-1 KBUsually safe unless third-party cookies are broad.
Login SessionSession cookie and CSRF token2-4 KBWatch cookie domain and path scope.
JWT APIBearer token and trace IDs2-5 KBJWT claims are often the biggest contributor.
Analytics HeavyMultiple tracking cookies4-8 KBCan break older 8 KB proxy defaults.
SSO PortalIdentity cookies and auth assertions5-10 KBConfirm the smallest enterprise proxy hop.
Microservice Tracetraceparent, baggage, forwarding headers3-9 KBRepeated internal forwarding can amplify size.
Mobile AppAuth token, app version, device headers1.5-4 KBUsually predictable, but token refresh can spike.
CDN EdgeGeo, bot, cache, forwarded headers2-6 KBEdge products may add fields before origin.
Legacy Cookie StackOld experiments and stale cookies6-12 KBExpires cleanup is often the fastest win.
Near Proxy LimitLarge cookies plus long JWT8-16 KBExpect intermittent 431/400 errors by path.
💡Header Sizing Tips
Gzip note: HTTP request headers are not protected by normal response gzip savings. HPACK/QPACK can compress HTTP/2 or HTTP/3 header fields on a connection, but you should still design raw headers to fit intermediary limits.
Cookie control: Keep cookies scoped to the smallest useful domain and path, expire old experiment cookies, and avoid storing profiles, carts, or permissions directly in Cookie values.
Auth token control: Shorten JWT claim names, remove unused claims, prefer opaque reference tokens for browsers, and account for the literal "Authorization: Bearer " prefix when testing.
Proxy buffer: Tune proxy buffers only after measuring every hop. Raising a limit can hide a bad cookie design and increase memory pressure during spikes.
How this calculator counts bytes: It models the request line and common fields, then adds Cookie, Authorization, User-Agent, custom header value bytes, field-name overhead, CRLF line endings, and the final empty CRLF. The proxy warning is based on the raw header size plus the selected safety buffer because many failures happen before application code can respond cleanly.

I’m sure you’ve experienced it, your perfectly functional site has become a digital ghost town because… what was that error message again? Oh yeah, it was a strange 502 Bad Gateway or maybe a 431 Request Header Fields Too Large. The server wasn’t down. Your code wasn’t broken. You simply stuffed too much baggage in the envelope.

A web request’s HTTP headers should be a simple set of instructions on how to deal with the message’s body. Lightweight metadata. But somewhere along the way from an overly ambitious identity provider to a sprawling analytics platform, those headers balloon until they snaps against the wire.

Why Your Website Headers Are Too Big

If you know your numbers, use the calculator up top; it’ll run the math for you. But more importantly: where does that bloat come from? Where does this bloat comes from? Most developers think about page content when they think “data transfer,” rather than the overhead preceding it. They’ll spend hours optimizing an image into a different file format that saves them twenty kilobytes and pat themselves on the back, without realizing they’ve got one cookie header adding three kilobytes to each and every request.

This kind of inefficiency compounds. It slows down time-to-first-byte, it consumes bandwidth on mobile connections, and finally it trips the safety wires on your infrastructure. The trick is to understand what exactly you’re measuring. Browsers and proxies counts bytes differently than you do when you look at them in your text editor.

Typically, it’s cookies. By default, they’ll stick around with each request unless you scope them different. One thing is a session token. Another is a legacy cookie. It contains abandoned cart data, experiment flags, and user preferences dating back three years. Take a look at these inputs on this tool. See how fast that number spikes as you expand your authorization bearer token length and add some custom headers.

The convenience of JWTs; no need to hit the DB to check state, is offset by their tendency to bloat by about thirty-three percent in base64, which blows up a binary value. And that’s where folks go wrong: they think their little JSON payload will remain little in transit. It won’t.

And then there’s the layer of the protocol itself. HTTP/2 offers header compression via HPACK, a method that shrinks down repeated field names and values across persistent connections. The calculator assumes that if you’re using HTTP/2, you’re already doing this. However, the first request sent over a newly established connection will still send everything raw. Depending on how many following requests are sent over that same connection, they may end up being leaner; however, that initial hit contributes to performance metrics. For users with mostly spotty cellular network connectivity, those cold starts compound.

Just having compression isn’t enough to save you from a poorly designed header strategy. It is one reason why it works, but it is not a cure-all. The tool’s reference tables also call out the importance of context. Sure, Cloudflare‘s edge will happily slurp down thirty-two kilobytes of headers. But maybe you’re running behind an Nginx reverse proxy, which has been tuned with an eight-kilobyte buffer. Now request dies before it ever reaches your code. The weak spot in the chain is always the bottleneck.

Audit each hop from the browser to the origin server. That includes any CDN you’re using, your load balancer, and even your internal service mesh. These are all places where additional tracing headers might be injected. While they’re invaluable when it comes time to debug something, they also use up space. You might have a distributed trace ID here or a baggage context there. Suddenly, at peak traffic, you’ve pushed a healthy request past the limit.

But increasing the proxy limits isn’t always the answer (in fact it’s often not). The problem is that increasing buffer sizes only masks your design debt. Every server node will now has more memory pressure. And while you’ll delay that crash, eventually you’ll be right back there again.

What you want to do instead is see what really needs to go in the headers. That big piece of profile data? Put it in the body of the request. Want to get rid of some of that session state? Store it on the server and put a small identifier in the cookie. Those are architectural choices that result in speed and stability.

And finally there’s the matter of how large you make headers, which isn’t so much a question of counting bytes as it is a question of discipline. Ask yourself: does this bit of data really need to come along for every single trip down the wire? Keep the envelope light, and the message goes through fast. Get the message through and everybody wins. Avoid the ghost town of error pages, no more users hitting a wall they can’t explain, just users getting through. You should of kept things simpler from the start. It is much more comfortabley to manage small requests than large ones. The modern approach must handle this better then before.

HTTP Header Size Calculator for Proxy Limits

Related posts

Leave a Comment