HTTP Header Formatter
Convert between raw and key/value header formats
HTTP Headers
Formatted Output
Enter HTTP headers to format and analyze
The HTTP Header Formatter converts between raw HTTP header text and structured key-value representations, letting you parse headers from curl -v output, browser dev tools, or network captures into an editable format and build them back into valid HTTP header syntax. Paste a block of raw headers like Content-Type: application/json\nAuthorization: Bearer eyJ... and get a clean, structured table you can edit and export.
Understanding HTTP Headers
HTTP headers are the metadata that travels with every request and response on the web. They tell the server what content the client accepts, how to authenticate the request, how long to cache the response, and dozens of other details that control how the HTTP transaction behaves. If you have ever opened browser developer tools and looked at the Network tab, you have seen headers -- they are the Content-Type, Authorization, Cache-Control, and other key-value pairs listed under each request.
For day-to-day development work, you rarely need to think about header formatting because your HTTP client or framework handles it automatically. The formatting becomes a problem when you need to move headers between tools. You might copy headers from Chrome DevTools and need to paste them into a Postman collection. Or you grab verbose output from curl -v and need to extract just the response headers without the < prefixes. Or you are writing API documentation and need to present headers as a clean JSON object rather than raw text. Each tool expects a slightly different format, and manually reformatting is tedious and error-prone.
This formatter handles the conversion in both directions. In parse mode, it accepts raw headers from any common source -- browser developer tools, curl verbose output with > and < prefixes, tcpdump or Wireshark captures, or plain Key: Value text -- and produces a structured table or JSON output. In build mode, it takes JSON objects, tab-separated data, or one-per-line key-value pairs and produces properly formatted raw HTTP headers with correct casing conventions and line endings. The result is headers that are ready to drop into whatever tool or configuration you need.
How to Parse Raw HTTP Headers
- Paste raw HTTP headers from curl output, browser developer tools, or a packet capture into the input field.
- Click Parse to extract each header into a structured name-value table.
- Edit individual header values as needed.
- Copy the structured output as JSON or key-value pairs.
How to Build HTTP Headers from Key-Value Data
- Enter headers as JSON (
{"Content-Type": "application/json"}), line-separatedKey: Valuepairs, or tab-separated data. - Click Build to generate properly formatted raw HTTP headers.
- Copy the output for use in your HTTP client, server configuration, or documentation.
HTTP Header Formatting Examples
Parsing curl Output
Input (raw headers from curl -v):
Content-Type: application/json; charset=utf-8
X-Request-ID: 8f14e45f-ceea-367f-a27f-4eb04ef4e
Cache-Control: public, max-age=3600
Set-Cookie: session=abc123; Path=/; HttpOnly
X-RateLimit-Remaining: 98
Parsed Output:
| Header Name | Value |
|---|---|
Content-Type | application/json; charset=utf-8 |
X-Request-ID | 8f14e45f-ceea-367f-a27f-4eb04ef4e |
Cache-Control | public, max-age=3600 |
Set-Cookie | session=abc123; Path=/; HttpOnly |
X-RateLimit-Remaining | 98 |
Building from JSON
Input:
{
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIs...",
"Content-Type": "application/json",
"Accept": "application/json",
"X-Custom-Header": "my-value"
}
Output (raw headers):
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
Content-Type: application/json
Accept: application/json
X-Custom-Header: my-value
When to Use the HTTP Header Formatter
- Copying headers between tools -- Convert headers from Postman format to curl syntax or vice versa without manual reformatting.
- Editing complex header sets -- Parse a large block of headers into a structured view where individual values are easy to find and modify.
- API documentation -- Convert raw header captures into clean JSON for inclusion in API docs and README files.
- Comparing configurations -- Parse headers from two different environments into the same structured format for side-by-side comparison.
- Debugging network issues -- Extract and organize headers from packet captures or proxy logs for analysis.
- Server migration -- Convert headers between configuration formats when moving from one web server or CDN to another.
How HTTP Headers Are Structured
HTTP headers follow a simple Name: Value format defined in RFC 7230, but real-world headers have several nuances the formatter handles.
Header Name Conventions
Header names are case-insensitive per the HTTP specification. Content-Type, content-type, and CONTENT-TYPE all refer to the same header. The formatter preserves original casing when parsing and uses standard casing (e.g., Content-Type) when building.
Multi-Value Headers
Some headers appear multiple times in a response, and the HTTP spec defines how they combine:
- List-based headers like
Cache-Control,Accept, andViacan be combined with commas:Cache-Control: no-cache, no-store. - Set-Cookie is special -- Multiple
Set-Cookieheaders must remain separate and cannot be comma-joined. - Folded headers (now deprecated in HTTP/1.1) used leading whitespace to continue a value on the next line.
Line Endings
HTTP/1.1 requires \r\n (CRLF) line endings between headers. The formatter handles input with Unix (\n), Windows (\r\n), or mixed line endings and produces spec-compliant CRLF output when building.
Common Header Categories
| Category | Headers | Purpose |
|---|---|---|
| Content negotiation | Accept, Accept-Language, Accept-Encoding | Client tells server what formats it prefers |
| Authentication | Authorization, WWW-Authenticate, Proxy-Authorization | Identity and access control |
| Caching | Cache-Control, ETag, If-None-Match, If-Modified-Since | Cache behavior and validation |
| Security | Strict-Transport-Security, Content-Security-Policy, X-Frame-Options | Browser security policies |
| CORS | Access-Control-Allow-Origin, Access-Control-Allow-Methods | Cross-origin access rules |
| Rate limiting | X-RateLimit-Limit, X-RateLimit-Remaining, Retry-After | API usage controls |
Practical Tips for Working with HTTP Headers
When debugging API issues, the first thing to check is whether the Content-Type header matches the body format. Sending a JSON body with Content-Type: application/x-www-form-urlencoded (or worse, no Content-Type at all) is one of the most common causes of 400 Bad Request errors. The server tries to parse the body according to the declared content type, and when the format does not match, the parsing fails. This formatter lets you quickly inspect all headers together so you can spot mismatches at a glance.
Another frequent issue is header duplication. When you configure headers at multiple layers -- application code, reverse proxy, CDN -- it is easy to end up with duplicate headers that conflict. For example, your application might set Cache-Control: private while your CDN adds Cache-Control: public, max-age=3600. The behavior depends on which layer wins, and the result is often not what you intended. Parse the actual response headers and look for duplicates to catch these configuration conflicts early.
When working with security headers like Content-Security-Policy or Strict-Transport-Security, the formatter helps you verify that the values are syntactically correct before deploying them. A malformed CSP directive can break your entire site by blocking legitimate resources, and a missing includeSubDomains on HSTS can leave subdomains unprotected. Parse the header, review each directive separately, and test in report-only mode before enforcing.
Frequently Asked Questions
Are HTTP header names case-sensitive?
No. RFC 7230 specifies that header field names are case-insensitive. Content-Type and content-type are the same header. However, HTTP/2 requires lowercase header names, so the formatter can optionally lowercase all names for HTTP/2 compatibility.
How does the formatter handle duplicate headers?
When parsing, all header instances are preserved individually. When building, you can choose to keep duplicates separate (required for Set-Cookie) or merge them into comma-separated lists (valid for most other headers per RFC 7230 Section 3.2.2).
Can I paste headers directly from browser DevTools?
Yes. The formatter accepts the raw header format shown in Chrome DevTools, Firefox Network Inspector, and Safari Web Inspector. It also handles the > and < prefixes from curl -v verbose output and strips them automatically.
What is the difference between HTTP/1.1 and HTTP/2 header formatting?
HTTP/1.1 uses plain text headers with Name: Value format and CRLF line endings. HTTP/2 uses a binary encoding (HPACK compression) and requires all header names to be lowercase. Additionally, HTTP/2 replaces the request line (e.g., GET /path HTTP/1.1) with pseudo-headers like :method, :path, and :scheme. This formatter works with the text representation used in logs and developer tools, not the binary wire format.
How do I handle headers with very long values?
Some headers, particularly Set-Cookie and Content-Security-Policy, can have values spanning hundreds of characters. The formatter displays long values without truncation so you can see the complete content. When building headers, it does not add line folding (which is deprecated in HTTP/1.1) -- each header occupies a single line regardless of length.
Can I convert headers from one format to another in a single step?
Yes. Parse the headers from any supported input format, then switch to build mode to export in your desired format. This makes it easy to convert from curl output to JSON, from Postman to raw text, or from raw text to a structured table.
Related Tools
- Cookie Header Parser - Parse Cookie and Set-Cookie headers into structured attributes
- CORS Header Explainer - Understand and validate CORS header configurations
- HTTP Status Code Lookup - Look up status code meanings that accompany response headers
- User-Agent Parser - Parse the User-Agent header into browser, OS, and device components
- curl Command Builder - Build curl commands with custom headers