HTTP Header Parser
Parse raw HTTP headers into structured key-value pairs with content-type analysis
/v1/http-header-parse
curl -X POST "https://dns.toolkitapi.io/v1/http-header-parse" \
-H "Content-Type: application/json" \
-d '{"headers": "HTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nCache-Control: max-age=3600\nX-Request-Id: abc123"}'
import httpx
resp = httpx.post(
"https://dns.toolkitapi.io/v1/http-header-parse",
json={"headers": "HTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nCache-Control: max-age=3600\nX-Request-Id: abc123"},
)
print(resp.json())
const resp = await fetch("https://dns.toolkitapi.io/v1/http-header-parse", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({"headers": "HTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nCache-Control: max-age=3600\nX-Request-Id: abc123"}),
});
const data = await resp.json();
console.log(data);
# See curl example
{
"headers": {
"Content-Type": "application/json; charset=utf-8",
"Cache-Control": "max-age=3600",
"X-Request-Id": "abc123"
},
"count": 3,
"request_line": "HTTP/1.1 200 OK",
"content_type": {
"type": "application/json",
"params": {"charset": "utf-8"}
}
}
Try It Live
Description
How to Use
1. Send a POST with a JSON body containing the `headers` field — raw HTTP headers as a multi-line string.
2. The first line is automatically detected as a request or status line if it starts with `HTTP/` or contains ` HTTP/`.
3. Inspect `headers` for the parsed key-value pairs, `request_line` for the status/request line, and `content_type` for parsed media type details.
About This Tool
HTTP Header Parser takes raw HTTP headers (as you'd see in a `curl -v` dump or browser dev tools) and converts them into a structured JSON object. It automatically detects and separates the request/status line, parses all header key-value pairs, and extracts `Content-Type` details including media type and parameters.
Duplicate header names are collected into arrays.
Why Use This Tool
- Debugging — Parse headers from curl output or browser dev tools into a readable format
- Security auditing — Extract and review security headers (CSP, HSTS, X-Frame-Options)
- API testing — Verify response headers match expectations
- Log analysis — Parse header blocks from HTTP access logs
Frequently Asked Questions
How are duplicate headers handled?
Is the request/status line required?
Which Content-Type details are extracted?
Start using HTTP Header Parser now
Get your free API key and make your first request in under a minute.