Decoding HTTP Status Codes: Understanding the Meaning Behind the Numbers

Peace SandyPeace Sandy
12 min read

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 CodeMeaningDescription
100ContinueThe 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.
101Switch ProtocolsThe 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.
103Early HintsThis 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.
102ProcessingThis 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 CodeMeaningDescription
200OKThe 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.
201CreatedThe 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.
202AcceptedThe 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.
203Non-Authoritative InformationThe 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.
204No Content MeanThe 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.
205Reset ContentThe 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.
206Partial ContentWhen a client requests only part of a resource using the Range header, the server returns a 206 response code.
207Multi-Status WebDAVThe 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.
208Already Reported WebDAVThe 208 response code helps avoid repetition by indicating that the server has already responded to the request.
226[IM] Used HTTP Delta EncodingThe 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 CodeMeaningDescription
301Moved PermanentlyThe 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.
302FoundThe 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.
303See OtherThe server often sends a 303 See Other response to redirect the client to the requested resource at a different URL.
304Not ModifiedThe 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.
305Use ProxyThe 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.
306UnusedThe 306 code was used in the previous version but is no longer used; it is usually reserved.
308Permanent RedirectThe 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 CodeMeaningDescription
400Bad RequestThe 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.
401UnauthorizedThe 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.
402Payment RequiredThis status code was originally used for digital payments and is reserved for future use.
403ForbiddenThe 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.
404Not FoundThe 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.
405Method Not AllowedThe 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.
406Not AcceptableThe 406 status code is sent when the web server cannot find any content that matches the criteria given by the user agent.
407Proxy Authentication RequiredThe 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.
408Request TimeoutThe 408 Request Timeout error indicates that the server failed to receive a complete response within the required time frame.
409ConflictThe 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.
410GoneThe 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.
411Length RequiredThe server rejects the request with a 411 status code because the Content-Length header field is absent from the request body.
412Precondition FailedThe 412 status code means the server fails to meet the preconditions.
413Payload Too Large]The 413 status code means the server received a request body larger than it can process.
414URI Too LongThe 414 status code means the server refuses to accept the request because the URI is too long to interpret.
415Unsupported Media TypeThe 415 status code means the server rejects the request because it does not support the media format.
416Range not SatisfiableThe 416 status code means the server cannot fulfill the range specified in the request.
417Expectation FailedThe 417 status code means the server cannot meet the expectations indicated by the request header field.
418I’m a teapotThe 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.
421Misdirected Request MeanThe 421 status code means the server cannot produce a response to the request because it is not configured to do so.
422Unprocessable ContentDue to a semantic error, the 422 status code indicates that the server cannot process the request, even though it is in the correct format.
423LockedThe 423 status code means the server cannot handle the request because it is locked.
424Failed DependencyThe 424 Failed status code means the request fails because a previous request did not succeed.
425Too EarlyThe 425 status code means the server refuses to process a request that might be replayed.
426Upgrade RequiredThe 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.
428Precondition RequiredThe 428 status code means the origin server requires the request to be conditional.
429Too Many RequestsThe 429 status code indicates that the server receives too many requests simultaneously.
431Request Header Fields Too LargeThe 431 status code indicates that the server cannot process the request because the header fields are too large.
451Unavailable for Legal ResourceThe 451 status code indicates that the user requested an illegal resource.

Server Error Code [500 - 599]

Status CodeMeaningDescription
500Internal Server ErrorThe 500 status code indicates that the server encountered a situation it cannot handle.
501Not ImplementedThe 501 status code indicates that the server cannot handle the request because it does not support the requested method.
502Bad GatewayThe 501 status code indicates that the server cannot handle the request because it does not support the requested method.
503Service UnavailableThe 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.
504Gateway TimeoutThe 504 server error code indicates that the server did not receive a response within a reasonable time due to technical difficulties.
505HTTP Version Not SupportedThis means that the server does not support the HTTP response format used.
506Variant Also NegotiatesThis means that the software handling the request is incorrectly configured, causing an internal server error.
507Insufficient StorageThis means that the server cannot process the request because it lacks storage.
508Loop DetectedThis means that the server detected a loop while processing the request.
510Not ExtendedThis means that the server does not support the specified extensions and cannot process the request.
511Network Authentication RequiredThe 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

MDN Web Docs

I'd love to connect with you on Twitter | LinkedIn | GitHub

See you in my next blog article. Take care!!!

11
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