Developer Tools
Accept Header Builder
Build and parse the HTTP Accept, Accept-Encoding, and Accept-Charset headers with q-values. Rank content negotiation entries and copy client snippets.
Accept header builder and parser
Header
Tells the server which response media types the client prefers. A more specific media range wins over a wildcard at the same q-value.
Items
Accept preference list
Add a media type
Output
Your Accept header
53 bytes
Accept: application/json, text/plain;q=0.9, */*;q=0.1Request snippets
Paste into your client
The Accept header is wired into each example.
curl
curl -i -H 'Accept: application/json, text/plain;q=0.9, */*;q=0.1' 'https://api.example.com/resource'
JavaScript fetch
fetch("https://api.example.com/resource", {
headers: {
"Accept": "application/json, text/plain;q=0.9, */*;q=0.1",
},
})
.then((response) => response.text())
.then(console.log);axios
import axios from "axios";
axios.get("https://api.example.com/resource", {
headers: {
"Accept": "application/json, text/plain;q=0.9, */*;q=0.1",
},
}).then((response) => console.log(response.data));Python (requests)
import requests
response = requests.get(
"https://api.example.com/resource",
headers={"Accept": "application/json, text/plain;q=0.9, */*;q=0.1"},
)
print(response.status_code, response.text)Node.js (node:https)
import { request } from "node:https";
const url = new URL("https://api.example.com/resource");
const req = request(
{
hostname: url.hostname,
path: url.pathname,
headers: { "Accept": "application/json, text/plain;q=0.9, */*;q=0.1" },
},
(res) => {
let body = "";
res.setEncoding("utf8");
res.on("data", (chunk) => (body += chunk));
res.on("end", () => console.log(res.statusCode, body));
},
);
req.end();Go (net/http)
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.example.com/resource", nil)
req.Header.Set("Accept", "application/json, text/plain;q=0.9, */*;q=0.1")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.Status, string(body))
}Raw HTTP request
GET /resource HTTP/1.1 Host: api.example.com Accept: application/json, text/plain;q=0.9, */*;q=0.1
How quality values work
- Each item can carry a weight with ;q= from 0 to 1, up to three decimal places. Leaving it off means q=1.
- The server chooses the acceptable item with the highest q. A tie is broken by specificity for media types, so text/html beats text/* beats */*.
- q=0 means the item is not acceptable. For Accept-Encoding, identity;q=0 tells the server it must compress.
- Order in the header is a tie-breaker, not the primary sort. The q-value always wins first.
The three Accept headers
- Accept negotiates the response media type, like application/json or text/html.
- Accept-Encoding negotiates compression, like br, gzip, or zstd.
- Accept-Charset is obsolete: browsers always use UTF-8 and the Fetch standard forbids setting it. Some older APIs and proxies still read it.
- For language negotiation, use the dedicated Accept-Language tool; it follows BCP 47 rules rather than media ranges.
How to use
- Choose Build to compose a header, or Parse and rank to analyze an existing one. Then pick the header: Accept, Accept-Encoding, or Accept-Charset.
- In Build mode, add items from the presets or type your own, set a q-value on any item (leave it blank for the implicit 1.0), and reorder with the arrows.
- Read the normalized header value and the plain-English summary, then copy the value, the full header line, or a ready-to-paste client snippet.
- In Parse and rank mode, paste a header value (the Accept: prefix is optional) or load a sample to see the server preference order and any validation notes.
- Use the validation panel to fix out-of-range q-values, malformed media types, or duplicates. Everything runs in your browser with no signup.
About this tool
The Accept Header Builder is a browser-only workbench for the three HTTP content-negotiation request headers defined by RFC 9110 section 12.5: Accept for response media types, Accept-Encoding for compression codings, and Accept-Charset for charsets. All three share the same shape, a comma-separated list where each item can carry a quality value written as a semicolon followed by q equals a number from 0 to 1, so the tool treats them as one family with the right presets and validation for each. In Build mode you add items for the selected header, set a q-value on any of them, and reorder the list, and the tool emits a normalized header value plus copy-ready request snippets for curl, the fetch API, axios, Python requests, Node.js https, Go net/http, and a raw HTTP request, with the header wired into each example. A plain-English summary explains what the server is being asked to prefer, including the rule that a more specific media range wins over a wildcard at the same q, so text/html is chosen over text/* which is chosen over */*, and the convention that a q-value of 0 marks an item as not acceptable. In Parse and rank mode you paste any existing Accept, Accept-Encoding, or Accept-Charset value, with or without the header name prefix, and the tool tokenizes it, validates each q-value and token against the HTTP grammar, flags duplicates and out-of-range or over-precise weights, and then ranks the entries exactly the way a server negotiates: highest q first, then by specificity, then by original order, so you can see at a glance which item wins and which are refused. The tool understands the practical gotchas too, such as identity;q=0 forcing compression for Accept-Encoding, the obsolescence of Accept-Charset in browsers and the Fetch standard, and the fact that Accept-Language follows separate BCP 47 rules and has its own dedicated tool. Everything is computed locally with native string handling and TextEncoder for the byte count, so the header values you enter are never uploaded, logged, or sent anywhere.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
Accept-Language Header Parser
Parse, build, and run RFC 4647 lookup matching against an Accept-Language header.
Open tool
DeveloperHTTP Headers Parser
Parse, classify, and decode HTTP headers, with a missing security headers audit.
Open tool
DeveloperCORS Headers Generator
Build Access-Control headers with live validation and Apache, Nginx, Vercel, Netlify, Next.js, Worker, and Express snippets.
Open tool
DeveloperVary Header Builder
Build, parse, and test HTTP Vary headers with cache key simulation for shared CDN caches.
Open tool
DeveloperCache-Control Header Builder
Build and parse Cache-Control headers with directive flags, max-age presets, conflict checks, and ready-to-paste server snippets.
Open tool
DeveloperMIME Type Lookup
Find the MIME type for any extension, with Content-Type header and aliases.
Open tool