Master HTTP Status Codes: A Complete Cheat‑Sheet for Developers
This article provides a concise yet comprehensive guide to HTTP and its response status codes, explaining each class of codes (1xx‑5xx) and highlighting the most common codes developers encounter when building web applications.
Whenever a client sends a request to a server, the response always includes a status code. Users may not see it, but developers can view it via packet capture; it is returned on every client‑server interaction.
Even non‑programmers may recognize the 404 Not Found error.
In this article we discuss everything about HTTP and its response status codes, serving as a handy reference whenever you encounter them.
What this article covers
1. What is HTTP? 2. What are status codes? 3. 1XX – Informational codes 4. 2XX – Success codes 5. 3XX – Redirection codes 6. 4XX – Client error codes 7. 5XX – Server error codes
What is HTTP?
HTTP stands for Hypertext Transfer Protocol. According to Wikipedia:
Hypertext Transfer Protocol is an application‑layer protocol for distributed, collaborative, hypermedia information systems.
HTTP is a client‑server protocol that underlies any data exchange on the Web. Each interaction between client and server is called a message, which can be a request or a response. The client sends an HTTP request, and the server replies with an HTTP response.
What are status codes?
For every client request, the server responds with a code that conveys the request’s status, allowing a quick check of success without inspecting the response body.
These codes consist of three digits, grouped into five standard classes identified by the first digit:
1XX – Informational
2XX – Success
3XX – Redirection
4XX – Client error
5XX – Server error
Below is a brief overview of each class and the most common codes.
1XX – Informational responses
Informational responses indicate that the request has been received and understood and that processing is continuing.
100 – Continue: Server has received the request headers and the client should continue sending the request body.
101 – Switching Protocols: The requester asks the server to switch protocols, and the server agrees.
102 – Processing: The server has received and is processing the request but no response is yet available.
103 – Early Hints: Used to return some response headers before the final HTTP message.
2XX – Success
These codes indicate that the client’s request was successfully received, understood, and accepted.
200 – OK: Standard response for successful HTTP requests.
201 – Created: The request has been fulfilled and resulted in a new resource being created.
202 – Accepted: The request has been accepted for processing, but the processing has not been completed.
204 – No Content: The server successfully processed the request and is not returning any content.
3XX – Redirection
This class indicates that further action must be taken by the client to complete the request.
301 – Moved Permanently: The URL has been permanently moved to a new location.
305 – Use Proxy: The requested resource must be accessed through the proxy given by the response.
307 – Temporary Redirect: The resource resides temporarily under a different URI.
4XX – Client error
These codes indicate that the error seems to have been caused by the client.
400 – Bad Request: The server cannot or will not process the request due to a client error.
401 – Unauthorized: Authentication is required and has failed or has not yet been provided.
403 – Forbidden: The server understood the request but refuses to authorize it.
404 – Not Found: The requested resource could not be found.
405 – Method Not Allowed: The request method is known by the server but is not supported by the target resource.
414 – URI Too Long: The URI provided was too long for the server to process.
429 – Too Many Requests: The user has sent too many requests in a given amount of time.
5XX – Server error
These codes indicate that the server failed to fulfill a valid request.
500 – Internal Server Error: A generic error message when no more specific message is suitable.
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, received an invalid response from the upstream server.
503 – Service Unavailable: The server is not ready to handle the request, often due to overload or maintenance.
This concludes the entire content of the article.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
