Xerobit

HTTP Header Parser: Raw Headers to JSON

Paste raw HTTP request or response headers to instantly parse them into structured JSON. This http header parser handles multi-line folded values, duplicate keys and status lines, running entirely in your browser so nothing is uploaded.

Result

{
  "Content-Type": "application/json",
  "Authorization": "Bearer token123"
}

How to use the http header parser

  1. Paste your raw HTTP headers into the text area. Both \r\n (CRLF) and \n (LF) line endings are supported.
  2. The http header parser automatically detects whether the first line is a status line or request line and labels it as _status.
  3. View the parsed output as formatted JSON below the input field.
  4. Copy the JSON result for use in scripts, API testing tools or debugging workflows.

How HTTP header parsing works

An HTTP message consists of a start line followed by header fields, each on its own line, separated from the body by a blank line. A header field has a name, a colon and a value. For example, Content-Type: application/json sets the content type to JSON.

The parser splits the input on line breaks. If a continuation line starts with a space or tab, it is appended to the previous header value with a single space replacing the leading whitespace, following RFC 7230 obsolete line folding rules. The first line is checked against known patterns: if it starts with HTTP/ it is a response status line, and if it starts with GET, POST, PUT, DELETE, PATCH, HEAD or OPTIONS it is a request line. These are stored under the special key _status.

Handling duplicate header names

HTTP allows multiple headers with the same name. A common example is the Set-Cookie header in responses. When this http header parser encounters duplicate names, it collects all values into a JSON array rather than overwriting the previous value.

For instance, two Set-Cookie headers become:

Raw inputJSON output
Set-Cookie: a=1
Set-Cookie: b=2
{"Set-Cookie": ["a=1", "b=2"]}

This matches how most server frameworks expose headers internally and avoids silent data loss.

Common HTTP headers reference

Below is a quick reference of frequently seen headers you might paste into this tool:

HeaderPurpose
Content-TypeMIME type of the body, e.g. application/json
AuthorizationCredentials for authentication, often Bearer <token>
Cache-ControlDirectives for caching, e.g. no-cache or max-age=3600
User-AgentClient software identifier string
AcceptContent types the client can process
X-Forwarded-ForOriginating IP address through proxies

If you need to inspect cookies specifically, consider using a dedicated cookie parser after extracting the Cookie or Set-Cookie values here.

Practical uses for parsed headers

Developers frequently need to convert raw headers captured from network tabs, log files or packet captures into structured data. Parsed JSON output can be fed directly into scripts, used to configure API clients like Postman or curl, or compared across environments.

When debugging CORS issues, parsing the Access-Control-Allow-Origin and related headers quickly reveals misconfigurations. Similarly, verifying that security headers like Strict-Transport-Security or Content-Security-Policy are present becomes straightforward once they are extracted into a readable format.

Edge cases and limitations

This parser expects only the header block. If you include the HTTP body, everything after the first blank line is ignored because the parser stops at the empty line that separates headers from the body per the HTTP specification.

Header names are preserved exactly as typed. While HTTP header names are case-insensitive according to the specification, the JSON keys retain their original casing so you can see exactly what was sent. Two lines whose names differ only in case, such as Accept and accept, are the same header and are merged under the first spelling. Values are trimmed of surrounding whitespace but internal spacing is kept intact.

Worked examples

ExampleInputResult
Response headersRaw HTTP headers: HTTP/1.1 200 OK / Content-Type: text/html; charset=utf-8 / Cache-Control: no-cache / Set-Cookie: session=abc123; Path=/ / Set-Cookie: theme=dark; Path=/{ / "_status": "HTTP/1.1 200 OK", / "Content-Type": "text/html; charset=utf-8", / "Cache-Control": "no-cache", / "Set-Cookie": [ / "session=abc123; Path=/", / "theme=dark; Path=/" / ] / }
Request headersRaw HTTP headers: GET /api/data HTTP/1.1 / Host: example.com / User-Agent: Mozilla/5.0 / Accept: application/json / Authorization: Bearer eyJhbGciOiJIUzI1NiJ9{ / "_status": "GET /api/data HTTP/1.1", / "Host": "example.com", / "User-Agent": "Mozilla/5.0", / "Accept": "application/json", / "Authorization": "Bearer eyJhbGciOiJIUzI1NiJ9" / }
Folded header valueRaw HTTP headers: Subject: This is a very long / subject line that wraps / X-Priority: 1{ / "Subject": "This is a very long subject line that wraps", / "X-Priority": "1" / }

FAQ

Does this http header parser send my data to a server?

No. All parsing happens locally in your browser using JavaScript. Your headers are never transmitted anywhere.

Can I paste both request and response headers?

Yes. The parser auto-detects request lines like GET /path HTTP/1.1 and response status lines like HTTP/1.1 200 OK, storing them under the _status key.

What happens if a header appears more than once?

Duplicate header names are collected into a JSON array so no values are lost. This is especially useful for Set-Cookie headers.

Are CRLF and LF line endings both supported?

Yes. The parser normalizes both carriage-return plus line-feed and plain line-feed endings before processing.

Does it handle multi-line folded header values?

Yes. Continuation lines starting with a space or tab are joined to the previous header value with a single space, following the obsolete line folding rules in RFC 7230.

What if I paste headers along with the body?

The parser stops reading at the first blank line, which marks the boundary between headers and body in HTTP messages. Body content is ignored.