The header is Accept, and it tells the server which media types the client is willing to receive in the response body. It's a comma-separated list of MIME types, and each entry can carry a quality value that ranks preferences. A browser sends something like Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 on nearly every navigation. If you send no Accept header at all, servers are entitled to assume you accept anything.

Why Accept Exists and What the Client Is Actually Declaring

HTTP separates what a client can process from what a server has stored. Accept is the mechanism that lets a client state the first half of that bargain before the server picks a representation. The header is defined in RFC 9110, the current HTTP semantics specification maintained by the IETF HTTP Working Group, which replaced RFC 7231 in June 2022.

The declaration is about response body format, not about the URL. You can request the same resource and get JSON or XML depending on what you put in Accept. That's content negotiation, and Accept is its client-side lever.

What clients rarely internalize is that Accept is advisory input, not a command. A server may ignore it, return 406 Not Acceptable, or pick the closest match anyway. The header shapes the server's choice; it doesn't force it.

Headers that look similar do different jobs. Content-Type describes what a body actually is, whether in a request or a response. Accept describes what a client wants. Confusing the two is the most common header mistake in API work.

The Media Range Syntax and Where Wildcards Are Permitted

Every element in Accept is a media range, which follows the type/subtype pattern with optional parameters. Wildcards are legal in Accept but only in specific positions. The three forms are type/* for any subtype of a known type, / for anything at all, and nothing else β€” */json is not valid syntax.

Parameters after a media range refine the offer. The q parameter carries the quality value. Other parameters, such as charset=utf-8 or version=2, restrict what the client will accept for that specific range.

A single header can list dozens of ranges. There's no practical limit in the specification, though intermediaries and servers impose their own caps. Most web servers accept a few kilobytes of header value before rejecting the request with a 431 Request Header Fields Too Large.

Order in the list does not imply preference. Only q values do. A client that writes application/json, text/html with no q values is saying both are equally acceptable, even if the author meant to rank them.

What a Real Browser Sends and Why the Numbers Look Odd

Chrome, Firefox, and Safari all send a long Accept header on top-level navigation, and the structure has been stable for years. The typical shape is text/html first at implied q=1, then application/xhtml+xml at q=1 or 0.9, then application/xml at q=0.9, then / at q=0.8.

The trailing /;q=0.8 is the interesting part. It means the browser will take anything else at lower priority, which is why servers rarely return 406 to a normal page load. The browser is signaling tolerance, not indifference.

Subresource requests carry narrower headers. An image fetch sends Accept: image/avif,image/webp,image/apng,image/svg+xml,image/,/*;q=0.8 in Chrome, which lets a server with AVIF and WebP variants of the same image pick the best format the browser can decode. That's content negotiation doing real work on every image-heavy page.

Firefox and Safari publish slightly different lists, and the lists change between browser versions. If you're debugging negotiation behavior, check the actual header your build sends rather than assuming a memorized string.

Quality Values, the Default of 1, and the Three-Decimal Rule

The q parameter is a number between 0 and 1 with at most three decimal places. RFC 9110 defines the default as 1, meaning a range without q is preferred over any range with a lower value. A q=0 explicitly marks a type as unacceptable, which is different from omitting it.

Three decimal places is a hard limit in the grammar, not a rounding suggestion. A client that sends q=0.9999 is sending invalid syntax, and a strict server may reject the whole header or the individual range. Most servers are lenient, but don't rely on it.

Preference order is not a simple sort. When two ranges have the same q, the more specific range wins. So text/html;q=0.8 beats text/*;q=0.8 beats /;q=0.8 for an HTML response, even though all three say the same thing numerically.

Ties at equal specificity are undefined, and servers resolve them however they like. That's why some negotiation libraries recommend scoring each available representation against every range and picking the highest-scoring one rather than trying to work out client intent.

Client Intent Header Value Server Behavior
Only JSON application/json JSON or 406
JSON preferred, XML acceptable application/json, application/xml;q=0.8 JSON unless unavailable
Anything except HTML /, text/html;q=0 Non-HTML representation
Prefer images, will take anything image/*, /;q=0.5 Image if present, else any type
Nothing is acceptable /;q=0 406 Not Acceptable

How a Negotiating Server Scores Candidates Against the Header

A server with three representations β€” HTML, JSON, XML β€” scores each against the incoming ranges and picks the winner. The scoring loop, as described in the RFC's own examples, treats the most specific matching range as authoritative for that representation.

Take a request with Accept: text/*, text/plain, text/plain;format=flowed, /. A text/plain body with format=flowed scores against the most specific matching range, which is the flowed variant, at its q value. A plain text/plain body scores against the text/plain range. An application/json body scores against /. The server picks the representation with the highest final score.

If every representation scores zero β€” because the client sent Accept: application/pdf and the server only has HTML β€” the correct response is 406 Not Acceptable. The RFC also permits returning a representation anyway, but if the server does that it should explain why, and 406 remains the honest answer.

A subtle failure surfaces here. Servers that send Vary: Accept on responses let caches distinguish negotiated variants. Servers that forget Vary: Accept can serve a JSON body to a client that asked for HTML because a shared cache stored the wrong variant. That bug shows up in production as mysterious Content-Type mismatches and is worth checking whenever a proxy sits between client and origin.

When Accept Is Missing, Malformed, or Ignored

An absent Accept header means the client accepts any media type, not that it wants none. RFC 9110 says a client without Accept is treated as though it sent /. Servers that return 406 to a header-less request are technically wrong, though some strict API implementations do it anyway.

Malformed syntax is a different case. A header like Accept: application/json;q=abc violates the grammar, and the server can reject it with 400 Bad Request. Most servers strip the bad range and continue, which is why broken clients often go unnoticed until they hit a strict server.

406 Not Acceptable is the response when the server decides it cannot satisfy the header. It's rare in browser traffic because of the trailing /, and common in API traffic where clients send narrow lists. If you're seeing 406 on an API call, the Accept value and the server's supported types are the two places to look.

Content negotiation is also optional for servers. A static file server that only ever serves HTML is free to ignore Accept entirely and return the HTML with 200 OK. The header is a request, not a guarantee, and clients that rely on negotiation should be prepared for a server that ignores it.

Accept Variants That Answer Different Questions

Six other headers look like Accept and answer different questions. Mixing them up is the most common way API integrations go wrong.

Header Negotiates Typical Value
Accept Response media type application/json
Accept-Charset Response character set utf-8, iso-8859-1;q=0.5
Accept-Encoding Response compression gzip, br, deflate
Accept-Language Response human language en-US, en;q=0.9
Accept-Ranges Server's announcement (response only) bytes
Content-Type Actual body media type application/json; charset=utf-8

The one that causes real production incidents is Content-Type. A client that sends Accept: application/json but sets Content-Type: text/plain on a POST with a JSON body is telling the server, through two different headers, two incompatible things. Some APIs will parse the body anyway. Some will reject it. The fix is to set Content-Type on requests that carry a body and reserve Accept for describing the response.

Accept-Ranges is a response header, not a request one. Clients that send it are wrong, and servers that treat an incoming Accept-Ranges as a negotiation signal are wronger.

Debugging Content Negotiation Failures on Real Traffic

Three failure patterns account for most negotiation bugs in production. Each has a diagnostic signature you can spot in logs, and each points at a specific fix.

1: Wrong Content-Type on the response. The server returned 200 OK with a body, but the response Content-Type doesn't match what the client sent in Accept. Cause: the server ignored the header, or a Vary: Accept header is missing and a cache served the wrong variant. Fix: add Vary: Accept to negotiated responses and verify the origin's negotiation logic against the three-representation example above. 2: 406 Not Acceptable on a call that should work. The client sent a narrow Accept list and the server has no matching representation. Fix: either add the missing representation on the server or widen the client's list, and confirm the exact media type string β€” application/vnd.api+json is not the same as application/json. 3: 400 Bad Request on the Accept header itself. Syntax is invalid. Cause: a q value with more than three decimals, a malformed media range, or an unescaped parameter. Fix: log the raw header value and validate against the grammar before shipping.

A fourth case is easy to miss. A client sends Accept: application/json with no q parameters and no /, and the server has JSON and XML. The negotiation picks JSON at q=1 and the XML is at an implicit zero because no range matches it. If the JSON encoder then fails mid-response, the server has no fallback. Servers that depend on negotiation for reliability should either send a permissive / in addition to the preferred type or implement a second-choice path.

Chrome DevTools and the Network panel show the request Accept value per request, and server access logs typically capture the response Content-Type. Pairing them per request catches most of these bugs within an hour of traffic.

Origin, Version History, and the Q-Value's Uncertain Beginnings

Content negotiation was in HTTP from the start. HTTP/1.0, published as RFC 1945 in May 1996, already defined Accept alongside Accept-Charset and Accept-Encoding, which suggests the mechanism existed in draft form before that. The q parameter's precise origin is less clear β€” it appears in the HTTP/1.1 specification, RFC 2068, published in January 1997, and no earlier public document is commonly cited as its source.

HTTP/1.1 was revised as RFC 2616 in June 1999, which became the reference implementation for over a decade. RFC 7231 in June 2014 split the specification and cleaned up the language around media ranges and quality values. RFC 9110 in June 2022 is the current document.

The practical effect of that history is that browser Accept headers have been extremely stable for years while server-side negotiation libraries vary widely in strictness. If you're integrating against an unfamiliar API, test its negotiation behavior directly rather than assuming it follows the RFC examples.

Designing APIs and Server Responses Around Accept

For API designers, Accept offers two operating models. The first is strict negotiation: parse the header, score representations, return 406 when nothing matches. The second is permissive: return the canonical representation and ignore Accept unless it names an unsupported format explicitly. Both are valid; the choice depends on client diversity.

A strict model works when the API has a small, well-defined set of media types and clients are under your control. Send Vary: Accept on every negotiated response, and document the supported types in the API reference. A permissive model works when clients send a wide variety of headers and you'd rather serve something than nothing.

Use vendor media types when a resource has multiple representations of the same format. application/vnd.mycompany.v2+json signals version inside the type, which lets a single Accept header express version and format together. That's less error-prone than relying on URL versioning when the underlying resource is identical.

Return 406 honestly when nothing matches. A server that always returns 200 with a fallback format trains clients to ignore negotiation, which means clients never send the header that would let the server do its job.

FAQ

Is Accept a request or response header?

It's a request header, but Accept-* family headers like Accept-Ranges are response headers. Accept itself only makes sense on requests, and servers that parse it do so to pick a response body. Clients that send Accept and expect a response header of the same name are looking at the wrong mechanism. The response gives the answer through Content-Type.

What happens if more than one range matches a representation?

The most specific matching range wins, so text/html beats text/* beats / at the same q. If a representation matches several ranges at different specificity, the highest-specificity range's q value is the score. That's why a client can send /;q=0.1 and still get HTML at q=1 if it also lists text/html without a q value.

Can a server return a type the client didn't list?

Yes, and the RFC permits it, but the server should explain the choice. Most servers prefer 406 Not Acceptable when nothing matches, because returning an unlisted type surprises clients. Clients that need to accept anything should include / β€” leaving it out is a deliberate restriction, and servers are entitled to honor it.

How does the browser's trailing /;q=0.8 affect negotiation?

It lowers the risk of 406 on page loads to near zero while keeping specific types ranked higher. A server with both HTML and JSON representations, when a browser requests the resource, sees HTML at q=1 and / at q=0.8. Without the /, a server missing HTML would have to return 406.

Do caches need Vary: Accept to work correctly?

Yes. A shared cache that stores a response without Vary: Accept can serve a JSON body to a client that requested HTML. The bug is invisible in tests run without a caching layer and common in production. If a proxy or CDN sits between client and origin, verify that negotiated responses include Vary: Accept on every route that varies output by media type.

What's the difference between Accept: / and no Accept header?

Functionally identical per RFC 9110: a missing Accept is treated as /. The practical difference is diagnostic. A client that explicitly sends / is easy to identify in logs as a permissive client, while a missing header could indicate a misconfigured request builder. Both mean "any media type is acceptable."

Could a malformed Accept cause a request to be rejected entirely?

Yes, if the server is strict. 400 Bad Request is the appropriate response to invalid Accept syntax. The most common cause is a q value with four or more decimal places, such as q=0.9999. Most servers strip the bad range and proceed, so a malformed header can go unnoticed until it hits a strict intermediary or origin server.