Parse HTTP header

Parse HTTP header lines into normalized names, raw values, and repeated fields.

freeworks offlinenothing uploaded
ToolHTTP Header Parser
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Lines split at the first colon, field names normalize case-insensitively, obsolete folding is handled or rejected, and comma-list fields can be tokenized. Duplicate fields stay distinct unless their field rules allow combination.

  • Case-insensitivity applies to names, not arbitrary values.
  • Raw preservation avoids lossy parsing.

Worked example

Parse three common response headers
Parse Content-Type, Cache-Control, and X-Request-Id into structured JSON
Input
											Content-Type: application/json
Cache-Control: no-cache
X-Request-Id: abc-123
										
Output
												Name           Value
-------------  ----------------
Content-Type   application/json
Cache-Control  no-cache
X-Request-Id   abc-123
											

When to use this

Proxy logs, API debugging, and security reviews parse headers.

Edge cases

  • A comma inside quotes is not necessarily a list separator.
  • Set-Cookie fields must not be joined like ordinary lists.
  • HTTP optional whitespace is not every Unicode whitespace character.

References