What are HTTP Response Codes? Here’s a List With An Explanation of Each
HTTP response codes, also known as HTTP status codes or header response codes, are a set of three-digit numeric codes returned by a web server in response to an HTTP request made by a client (usually a web browser or another application). These status codes are included in the response headers of an HTTP response to provide information about the outcome of the request. They serve several important purposes:
- Communication: HTTP response codes allow the webserver to communicate the result of a client’s request back to the client in a standardized way. This communication is essential for understanding whether the request was successful or encountered an issue.
- Error Handling: They help in error handling and debugging. When a request fails or encounters an issue, the status code explains what went wrong. This information is valuable for developers and administrators to identify and fix problems.
- Redirection: HTTP response codes like 301 (Moved Permanently) and 302 (Found) are used for redirection. They inform the client that the requested resource has been moved to a different URL. This is important for maintaining web page links and SEO.
- Caching: Some status codes, such as 304 (Not Modified), help in caching. If a client has previously requested a resource that hasn’t changed, the server can respond with a 304 status code, indicating that the client can use its cached copy, reducing server load and improving performance.
- Security: Certain status codes, like 401 (Unauthorized) and 403 (Forbidden), are used to enforce security measures. They indicate the client lacks proper authentication or authorization to access the requested resource.
- Resource Availability: Status codes like 404 (Not Found) or 410 (Removed) signify that the requested resource does not exist on the server. This is helpful for users and search engines to understand that the content they are looking for is unavailable.
- Performance Optimization: HTTP status codes can help optimize performance. For example, a 503 (Service Unavailable) status code informs the client that the server is currently overloaded or undergoing maintenance, prompting the client to try again later.
- Compatibility: They ensure compatibility and interoperability between web clients (browsers, mobile apps, etc.) and web servers. All parties can interpret and act upon status codes in a standardized way.
HTTP Response Code Classifications
HTTP response status codes are divided into five classes, each representing a different category of response:
- 1xx Informational response – The request has been received, and the server is continuing to process the request.
- 2xx Successful response – The request has been successfully processed, and the server is returning the requested information to the client.
- 3xx Redirection response – The requested resource has been moved or is temporarily unavailable, and the server redirects the client to a new URL or resource.
- 4xx Client error response – The request contains incorrect syntax or cannot be fulfilled, and the server cannot process the request.
- 5xx Server error response – The server cannot fulfill the request due to an error on the server side.
View HTTP Response Code Trace Your URL Redirects
HTTP Response Codes List
Code | Type | Description |
---|---|---|
100 | Continue | The initial part of the request has been received, and the client should continue with the request. |
101 | Switching Protocols | The server is switching protocols as requested by the client. |
200 | OK | The request was successful, and the server has returned the requested data. |
201 | Created | The request has been fulfilled, and a new resource has been created as a result. |
202 | Accepted | The request has been accepted for processing but is not yet complete. |
204 | No Content | The server successfully processed the request but does not need to return a response body. |
206 | Partial Content | The server is delivering only part of the resource due to a range request. |
300 | Multiple Choices | The request has multiple possible responses, and the client should choose one. |
301 | Moved Permanently | The requested resource has been moved permanently to a new URL. |
302 | Found | The requested resource has been temporarily moved to a new URL. |
303 | See Other | The response to the request can be found under a different URL. |
304 | Not Modified | The resource has not been modified since the last request. |
307 | Temporary Redirect | The request should be repeated with another URL, but the same method should be used. |
308 | Permanent Redirect | The request and all future requests should be repeated using another URL. |
400 | Bad Request | The server cannot understand the request, possibly because of incorrect syntax. |
401 | Unauthorized | The client does not have the necessary authorization to access the requested resource. |
402 | Payment Required | Reserved for future use. Originally intended for digital payment systems. |
403 | Forbidden | The client does not have permission to access the requested resource. |
404 | Not Found | The requested resource does not exist on the server. |
405 | Method Not Allowed | The request method is not supported for the requested resource. |
406 | Not Acceptable | The server cannot produce a response matching the list of acceptable values defined in the request’s headers. |
407 | Proxy Authentication Required | The client must first authenticate itself with the proxy. |
408 | Request Timeout | The server timed out while waiting for the request. |
409 | Conflict | Indicates that the request could not be completed due to a conflict with the current state of the target resource. |
410 | Gone | The requested resource is no longer available and will not be available again. |
411 | Length Required | The server requires a valid Content-Length header to be provided in the request. |
412 | Precondition Failed | One or more conditions specified in the request header fields evaluated to false. |
413 | Payload Too Large | The server refuses to process the request because the payload is too large. |
414 | URI Too Long | The server refuses to process the request because the URL is too long. |
415 | Unsupported Media Type | The server refuses to accept the request because the payload format is unsupported. |
416 | Range Not Satisfiable | The server cannot satisfy the range request specified in the request’s Range header field. |
417 | Expectation Failed | The server cannot meet the requirements of the Expect request-header field. |
418 | I’m a teapot | This code was defined as an April Fools’ joke and is not expected to be implemented. |
429 | Too Many Requests | The user has sent too many requests in a given amount of time. |
500 | Internal Server Error | The server encountered an error while processing the request. |
501 | Not Implemented | The server does not support the functionality required to fulfill the request. |
502 | Bad Gateway | The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed. |
503 | Service Unavailable | The server is currently unable to handle the request due to temporary overloading or maintenance of the server. |
504 | Gateway Timeout | The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server or application. |
505 | HTTP Version Not Supported | The server does not support the HTTP protocol version used in the request. |
507 | Insufficient Storage | The server is unable to store the representation needed to complete the request. |
511 | Network Authentication Required | The client must authenticate itself to get the requested response. |
599 | Network Connect Timeout Error | This status code is not specified in any RFC but is used by some HTTP proxies to signal a network connect timeout error. |
How To View An HTTP Response Code
The HTTP status code is a separate piece of information provided in the response headers when you request an HTTP to a web server. You can not see it in the output HTML displayed in a browser. To view the HTTP status code in Chrome Developer Tools, you would need to do the following:
- Open Chrome Developer Tools: Follow the steps mentioned earlier to open Chrome Developer Tools using
Ctrl + Shift + I
. - Network Tab: In the Developer Tools panel, navigate to the Network tab.
- Make a Request: Visit the web page or trigger the specific HTTP request you want to inspect. You will see network requests listed in the Network tab as they are made.
- Select the Request: Click on the specific network request corresponding to the page or resource you’re interested in. This will display detailed information about the request and response in the right panel.
- View Response Headers: In the right panel, go to the “Headers” tab. The HTTP response headers are displayed here, including the HTTP status code.
The HTTP status code will be listed in the response headers as Status Code with a brief description. For example, you might see 200 OK for a successful request, 404 Not Found for a resource that doesn’t exist, or 500 Internal Server Error for a server-side error.
HTTP response codes are a vital part of the HTTP protocol, providing a standardized and efficient means of communication between clients and servers, aiding in error handling, security, redirection, and overall web performance. They are essential for a well-functioning and reliable web ecosystem.