Status codes and reason phrases

In the HTTP response that is sent to a client, the status code, which is a three-digit number, is accompanied by a reason phrase (also known as status text) that summarizes the meaning of the code. Along with the HTTP version of the response, these items are placed in the first line of the response, which is therefore known as the status line.

The status codes are classified by number range, with each class of codes having the same basic meaning. When describing a range as a whole, it may be named as "1xx", "2xx", and so on. The HTTP protocol specifications do not define any status codes of 600 or greater.

Only a few status codes in each range are defined by the HTTP/1.0 and HTTP/1.1 specifications. The HTTP/1.1 specification includes more status codes than the HTTP/1.0 specification.

The reason phrases defined in the HTTP specifications (for example, "Not Found" or "Bad Request") are recommended but optional. The HTTP/1.1 specification says that the reason phrases for each status code may be replaced by local equivalents.

The 200 (OK) status code is used for a normal response that provides the full resource requested by the web client. Most other status codes are used in situations where there is an error that prevents fulfilment of the request, or where the client needs to do something else in order to complete its request successfully, such as following a redirection URL, or amending the request so that it is acceptable to the server.

The HTTP headers for the response, or the response body, or both, may provide further instructions and information for the client. The HTTP specifications include requirements and suggestions for the content of responses with each status code. The requirements specify:

For full information about the meaning and correct use of status codes, you should consult the HTTP specification to which you are working. See The HTTP protocol for more information about the HTTP specifications.



dfhtl_httpstatus.html | Timestamp icon Last updated: Thursday, 27 June 2019