HTTP content negotiation lets a client tell the server which representations it prefers using the Accept header, and the server returns the best match. Getting the quality factors and ordering right matters for APIs that serve JSON, XML, or multiple formats from one URL. This tool builds a valid header from sliders and explains exactly how a server will rank the options.
How it works
An Accept header is a comma-separated list of media ranges, each optionally tagged with a quality factor:
Accept: application/json, text/html;q=0.9, */*;q=0.8
When a server negotiates, it scores each representation it can produce against the client’s list using the rules in RFC 9110:
- Match the media range. A type matches
type/subtype, the subtype wildcardtype/*, or the full wildcard*/*. - Compare q-values. The match with the highest q-value wins. A q-value of
0means the type is not acceptable. - Break ties by specificity. When two ranges match with equal q, the most specific one applies — an exact
type/subtypebeatstype/*, which beats*/*. - Break remaining ties by order. If q and specificity are equal, most servers honour the order the client listed.
The builder formats q-values to at most three decimals, drops ;q=1 (the default), and lists types in descending preference so the output is unambiguous. The parser runs the same ranking on a pasted header and shows the resulting order.
Example
Given the rows application/json at q=1, application/xml at q=0.5, and */* at q=0.1, the tool emits:
Accept: application/json, application/xml;q=0.5, */*;q=0.1
A server that can produce both JSON and XML returns JSON, because 1.0 beats 0.5. If it can only produce plain text, the */*;q=0.1 range still makes that acceptable as a last resort.
Tips and notes
- Use
q=0to explicitly reject a format while still accepting others. - Keep the header close to common browser defaults if you care about request fingerprinting — unusual Accept headers stand out.
- Parsing and building both happen locally in your browser; nothing is sent anywhere.