Accept Header

Table of Content

The Accept header is a part of the HTTP (Hypertext Transfer Protocol) request that is sent by the client to inform the server about the media types which are accepted by the client. It plays a crucial role in content negotiation. HTTP content negotiation is a mechanism that uses HTTP headers to deliver the best representation of a resource. It allows the server to select a preferred representation and send it back to the client using the HTTP response, based on the media types as defined by the Accept header.


Accept: <media-type>/<subtype>


  • <media-type> is the type of the media. E.g., text, image, application, etc.
  • <subtype> is the subtype of the media. E.g., html, png, json, etc.


The Accept header uses multiple directives to refine the media type specification. The commonly used directives are:

  1. type/subtype: This specifies the media type and subtype, respectively.
  2. quality factor(from 0 to 1): This optional parameter signifies the weight of preference, default is 1.
  3. wildcard(): A wildcard () can be used to denote 'any'.


Accept: text/html
Accept: image/png
Accept: application/json
Accept: */*

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Supported
Safari Supported
Opera Supported
Edge Supported

How to modify Accept header

ModHeader is an extension for the Chrome that can modify the HTTP headers. You can use it to modify the Accept header as well.

Here's how:

  1. Install and open ModHeader.
  2. Click on '+', a row will appear.
  3. Under 'Header name', type 'Accept'.
  4. Under 'Header value', type your preferred media type, e.g., 'text/html'.

This will give the Accept header a new value, and it will only accept 'text/html' media. Modifying the Accept header lets you test how your application responds for different media types, which is useful for testing and debugging purposes.