Decoding HTTP Status Codes: Understanding the Meaning Behind the Numbers

HTTP status codes are an integral part of software development, and it’s essential to understand them well. Imagine you’re at a restaurant, placing an order. The interaction between you (the client) and the waiter (the server) mirrors how HTTP requests and responses work. Most people have probably encountered the famous 404 page not found ” error, a well-known example of an HTTP client error status code. There are many more.
This article provides a comprehensive guide to HTTP status codes, including how to optimize, use, and decode them. Each code offers specific information about the request-response cycle.
What are HTTP Status Codes?
HTTP status codes are three-digit responses from the server to a browser-side request. They are the universal language of web servers. The HTTP response status code communicates between the server and the internet browser, indicating whether the server-client interaction was successful or not.
These codes are often categorized into five: informational responses, successful responses, redirection messages, client error responses, and server error responses. By understanding the meaning behind each status code, users and developers can more effectively troubleshoot web issues.
Categories of HTTPS Status Codes
As earlier mentioned, HTTP status codes can be divided into five main classes: informational, success, redirection, client error, and server error. The first digit of the error code indicates the class difference. The HTTP status code returned by a web server indicates the result of an HTTP request. Knowing what this code means is essential for web developers, who often use it to communicate with clients and servers. The first digit of an HTTP status code defines the response class.
Informational Responses [1XX]: These codes are also known as informational codes; they provide responses that indicate the server is continuing the process and has received the request.
Successful Responses [2XX]: These responses indicate that the request was received, understood, and accepted.
Redirection Responses [3XX]: These codes redirect the client to a different resource or URL, indicating that more action is needed to complete the request.
Client Errors [4XX]: These indicate that the server was unable to fulfill the client’s request, meaning the client made an error.
Server Errors [5XX]: indicate a server failure, meaning the server was unable to complete the request. Server errors often originate from the server side.
Informational Responses [100 - 199]
Status Code | Meaning | Description |
100 | Continue | The 100 code indicates that the client should continue its request. The client usually sends this code before a POST request. Imagine a client like Postman or a browser that wants to upload a large file to a server using a POST request. |
101 | Switch Protocols | The server usually sends the 101 code in response to a client’s upgrade request header. It then switches protocols based on the requester’s instructions. |
103 | Early Hints | This code typically uses a “Link” header to instruct the client to prepare or start preloading resources before the server completes the response. It is helpful for preloading assets like scripts, images, and stylesheets. |
102 | Processing | This code indicates that the server has accepted the entire request and is processing it, but has not yet completed the task. Imagine booking a ride the app confirms your request and says, “Your driver is on the way. Please hold on.” |
Successful Responses [200-299]
Status Code | Meaning | Description |
200 | OK | The 200 code means that the request was successful. Imagine you’re at a restaurant and place an order for a meal. The server either brings you precisely what you ordered, like a 200 OK response in HTTP, or confirms that your order has been received and is being prepared, similar to a 201 Created response. The meaning of success depends on the HTTP method. |
201 | Created | The 201 status code indicates that the request was successful and either a new or multiple resources were created. The Location header provides the URL to access the new resource. This response often follows a POST request or an update to a PUT request. |
202 | Accepted | The 202 response code means the server has received the request but has not completed the processing. The processing may not be completed when it eventually occurs. |
203 | Non-Authoritative Information | The 203 response code means the data is copied directly from the central server. It is mainly used to back up another response, but has also been collected from a local copy or a third party. |
204 | No Content Mean | The 204 no content is self-explanatory, meaning there is no content to send back to the response body. Still, the server has fulfilled your request but has no additional information. This is commonly used for GET requests. |
205 | Reset Content | The 205 code tells the client to reset the document to its original state. The reset content is similar to a reset button, commonly used when clients want to revert to a previous version of a request. |
206 | Partial Content | When a client requests only part of a resource using the Range header, the server returns a 206 response code. |
207 | Multi-Status WebDAV | The server uses the 207 response code to communicate information about multiple resources and must return several responses. It’s like submitting a performance review with ratings for different skills or tasks. |
208 | Already Reported WebDAV | The 208 response code helps avoid repetition by indicating that the server has already responded to the request. |
226 | [IM] Used HTTP Delta Encoding | The 226 IM response code means the server has used a different method to fulfill a GET request for the resource. It’s like getting a fuel top-up for your car instead of filling up the entire tank. |
Redirection Messages [300-399]
Status Code | Meaning | Description |
301 | Moved Permanently | The 301 response code indicates that the target resource's URL has been moved to a new permanent URL. This usually occurs when a resource is moved to a new location, and we want to redirect the client to where it. |
302 | Found | The 302 response code means the resource has been temporarily moved to a new location. In this case, the user agent may continue to request data from this resource in future requests. |
303 | See Other | The server often sends a 303 See Other response to redirect the client to the requested resource at a different URL. |
304 | Not Modified | The 304 response code indicates that no changes or modifications have been made. It also means that when the user requests a resource, the server has not changed its content since the last time it was requested. |
305 | Use Proxy | The 305 use proxy is often referred to as deprecated. It instructs a client to use a proxy because the proxy needs to access the requested response. |
306 | Unused | The 306 code was used in the previous version but is no longer used; it is usually reserved. |
308 | Permanent Redirect | The 308 response code means that the requested resource has been permanently redirected to a different URI, specified in the Location response header. |
Client Error Response [400 - 499]
Status Code | Meaning | Description |
400 | Bad Request | The 400 response status code indicates that the server cannot process or understand the request. This could be due to an invalid or malformed request syntax. |
401 | Unauthorized | The 401 response code means that the client request has not been applied. The client must authenticate to get the requested response. This code is often used when the client needs to provide authentication to access a resource. |
402 | Payment Required | This status code was originally used for digital payments and is reserved for future use. |
403 | Forbidden | The 403 Forbidden response means that the client's request to the server has been rejected because the client does not have the necessary access rights to view the contents. Unlike the 401 error, the server knows the identity but cannot view the content. |
404 | Not Found | The 404 Not Found status code is the most common HTTP error; it means that the server cannot find the requested resource, so the request you made does not exist. |
405 | Method Not Allowed | The 405 method status code means that the server does not know the request method, and it has been disabled and can not be used. For example, the server will return this error if you attempt to send an HTTP DELETE request to a resource that only supports PUT and POST requests. |
406 | Not Acceptable | The 406 status code is sent when the web server cannot find any content that matches the criteria given by the user agent. |
407 | Proxy Authentication Required | The status code means the origin server requires the client to be authenticated by a proxy. Sometimes, the server may only allow access from specific IP addresses or networks, and your proxy may not meet that requirement. |
408 | Request Timeout | The 408 Request Timeout error indicates that the server failed to receive a complete response within the required time frame. |
409 | Conflict | The 409 Conflict status code means the server cannot complete the request because it is currently processing a conflicting one. It is often used when the user can resolve the Conflict and resubmit the request. |
410 | Gone | The server sends the 410 status code when it permanently removes the requested resource. This often happens when a resource is deleted from the server but still exists in your proxy's cache. |
411 | Length Required | The server rejects the request with a 411 status code because the Content-Length header field is absent from the request body. |
412 | Precondition Failed | The 412 status code means the server fails to meet the preconditions. |
413 | Payload Too Large] | The 413 status code means the server received a request body larger than it can process. |
414 | URI Too Long | The 414 status code means the server refuses to accept the request because the URI is too long to interpret. |
415 | Unsupported Media Type | The 415 status code means the server rejects the request because it does not support the media format. |
416 | Range not Satisfiable | The 416 status code means the server cannot fulfill the range specified in the request. |
417 | Expectation Failed | The 417 status code means the server cannot meet the expectations indicated by the request header field. |
418 | I’m a teapot | The 418 status code references an April Fools' joke called the HyperText Coffee Pot Control Protocol. The "I'm a teapot" status code means the server refuses to serve a request because it is, in fact, a request for a teapot. |
421 | Misdirected Request Mean | The 421 status code means the server cannot produce a response to the request because it is not configured to do so. |
422 | Unprocessable Content | Due to a semantic error, the 422 status code indicates that the server cannot process the request, even though it is in the correct format. |
423 | Locked | The 423 status code means the server cannot handle the request because it is locked. |
424 | Failed Dependency | The 424 Failed status code means the request fails because a previous request did not succeed. |
425 | Too Early | The 425 status code means the server refuses to process a request that might be replayed. |
426 | Upgrade Required | The server refuses to process the request using the current protocol, but it can do so once the client upgrades to a different version of the protocol. |
428 | Precondition Required | The 428 status code means the origin server requires the request to be conditional. |
429 | Too Many Requests | The 429 status code indicates that the server receives too many requests simultaneously. |
431 | Request Header Fields Too Large | The 431 status code indicates that the server cannot process the request because the header fields are too large. |
451 | Unavailable for Legal Resource | The 451 status code indicates that the user requested an illegal resource. |
Server Error Code [500 - 599]
Status Code | Meaning | Description |
500 | Internal Server Error | The 500 status code indicates that the server encountered a situation it cannot handle. |
501 | Not Implemented | The 501 status code indicates that the server cannot handle the request because it does not support the requested method. |
502 | Bad Gateway | The 501 status code indicates that the server cannot handle the request because it does not support the requested method. |
503 | Service Unavailable | The 503 server error code indicates that the server is temporarily unavailable to handle the request, possibly due to scheduled maintenance or a high volume of traffic. |
504 | Gateway Timeout | The 504 server error code indicates that the server did not receive a response within a reasonable time due to technical difficulties. |
505 | HTTP Version Not Supported | This means that the server does not support the HTTP response format used. |
506 | Variant Also Negotiates | This means that the software handling the request is incorrectly configured, causing an internal server error. |
507 | Insufficient Storage | This means that the server cannot process the request because it lacks storage. |
508 | Loop Detected | This means that the server detected a loop while processing the request. |
510 | Not Extended | This means that the server does not support the specified extensions and cannot process the request. |
511 | Network Authentication Required | The 511 authentication required response code indicates that the client must authenticate to gain network access. |
Conclusion
HTTP Status codes are beneficial, and there are many reasons to be familiar with them. Understanding how these codes are used will help you debug, optimize user experience, and improve performance. They are also essential for troubleshooting and will help you ensure seamless system reliability and user satisfaction.
Reference
I'd love to connect with you on Twitter | LinkedIn | GitHub
See you in my next blog article. Take care!!!
Subscribe to my newsletter
Read articles from Peace Sandy directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Peace Sandy
Peace Sandy
Technical Writer