HTTP headers to JSON converter
Useful for moving headers into fetch, axios or Postman code, or for comparing two requests.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Enter headers and lowercase header names.
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
Each line is split at the first : into name and value, and spaces around the value are trimmed. A start line such as GET /path HTTP/1.1 or HTTP/1.1 200 OK is set aside, a line starting with a space continues the previous value, and parsing stops at the first blank line. Names are compared case-insensitively.
Example
Inputs: Lowercase header names = no. Result: JSON: { "Host": "shop.example.com", "Accept": "application/json", "Accept-Language": "ar-SA,ar;q=0.9,en;q=0.8", "Cookie": "session_id=abc123", "Cache-Control": "no-cache" }; Header lines: 5; Start line: GET /api/orders?page=2 HTTP/1.1.
GET /api/orders?page=2 HTTP/1.1 Host: shop.example.com Accept: application/json Accept-Language: ar-SA,ar;q=0.9,en;q=0.8 Cookie: session_id=abc123 Cache-Control: no-cache
{
"Host": "shop.example.com",
"Accept": "application/json",
"Accept-Language": "ar-SA,ar;q=0.9,en;q=0.8",
"Cookie": "session_id=abc123",
"Cache-Control": "no-cache"
}Limits and caveats
- Repeated headers are kept as an array rather than joined with commas, since joining breaks Set-Cookie.
- Any message body after the blank line is ignored.
Questions about this tool
Are HTTP/2 headers such as :authority supported?
Yes. Names starting with a colon, as Chrome copies them, are accepted as they are.
What is the lowercase option for?
Header names are case-insensitive, and lowercasing them makes lookups in code easier; it is also the HTTP/2 form.
Why did I get an error for a line?
The line has no : or its name contains a space or a character HTTP does not allow; the message gives the line number.
