Accept header - HTTP | MDN

archived 4 Aug 2025 11:19:49 UTC

Accept header

Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The HTTP Accept request and response header indicates which content types, expressed as MIME types, the sender is able to understand. In requests, the server uses content negotiation to select one of the proposals and informs the client of the choice with the Content-Type response header. In responses, it provides information about which content types the server can understand in messages to the requested resource, so that the content type can be used in subsequent requests to the resource.
Browsers set required values for this header based on the context of the request. For example, a browser uses different values in a request when fetching a CSS stylesheet, image, video, or a script.
Header type Request header, Response header
Forbidden request header No
CORS-safelisted request header Yes*
* Values can't contain CORS-unsafe request header bytes, including "():<>?@[\]{},, Delete 0x7F, and control characters 0x00 to 0x19, except for Tab 0x09.

#Syntax

http
Accept: <media-type>/<MIME_subtype>
Accept: <media-type>/*
Accept: */*

// Multiple types, weighted with the quality value syntax
Accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8

#Directives

#<media-type>/<subtype>
A single, precise media type, like text/html.
#<media-type>/*
A media type without a subtype. For example, image/* corresponds to image/png, image/svg, image/gif, and other image types.
#*/*
Any media type.
#;q= (q-factor weighting)
A value in order of preference expressed using a relative quality value called the weight.

#Examples

#Using default Accept request headers

HTTP requests made using command line tools such as curl and wget use */* as the default Accept value:
http
GET / HTTP/1.1
Host: example.com
User-Agent: curl/8.7.1
Accept: */*
Browser navigation typically has the following Accept request header value:
http
GET /en-US/ HTTP/2
Host: developer.mozilla.org
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
After receiving the document, the default Accept values in requests for images on the developer.mozilla.org example look like this:
http
Accept: image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5

#Configuring Accept request headers for JSON responses

Systems that involve API interaction commonly request application/json responses. Here's an example of a GET request where the client specifically requests a JSON response:
http
GET /users/123 HTTP/1.1
Host: example.com
Authorization: Bearer abcd123
Accept: application/json

#Specifications

Specification
HTTP Semantics
# field.accept

#Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Accept
Chrome – Full support
Chrome 1 (Release date: 2008-12-11)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 1 (Release date: 2004-11-09)
footnote
footnote In Firefox 66, the default Accept header value changed to */*.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 1 (Release date: 2003-06-23)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote
footnote In Firefox for Android 66, the default Accept header value changed to */*.
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 1 (Release date: 2007-06-29)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 1 (Release date: 2007-06-29)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.
Full support Full support
See implementation notes.

#See also

0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%