HTTP Status Codes: A Clear Guide to Return Codes
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
HTTP status codes are three-digit numbers a web server sends back to a browser or app after every request, telling it whether the request worked, failed, or needs more action. This guide explains what each code range means, walks through the most common codes you will actually encounter, and shows you how to read and troubleshoot them.
Formula
The key to understanding any HTTP status code is its first digit. The class is simply the code divided by 100, rounded down:
class = ⌊status / 100⌋
- 1xx (100–199) – Informational: the server is still processing or has received the request.
- 2xx (200–299) – Success: the request was received, understood, and accepted.
- 3xx (300–399) – Redirection: further action is needed to complete the request.
- 4xx (400–499) – Client error: the request contains bad syntax or cannot be fulfilled.
- 5xx (500–599) – Server error: the server failed to fulfill a valid request.
For example, a 404 code gives class floor(404/100) = 4, so it is a client error. A 503 gives class 5, a server error.
Worked Example
Suppose you enter a status code of 404 and a response time of 250 ms. The calculator computes the class as floor(404/100) = 4, so the code falls in the 4xx client error range. The meaning is “Not Found” – the server could not find the requested resource. The response time is not used in the class calculation but is shown for context; a 404 with a very fast response time often means the server is healthy but the URL is wrong.
Why Status Codes Exist
HTTP status codes are part of the HTTP protocol, the foundation of data communication on the web. They were introduced in the early 1990s with HTTP/1.0 and refined in HTTP/1.1. The goal is to give a machine-readable, standardized way for servers to communicate the outcome of a request without requiring the client to parse a human-readable message. This allows browsers, search engines, and APIs to react automatically: a browser knows to follow a redirect on a 301, and a search engine knows not to index a page that returns 404.
Each code is a three-digit integer, but only the first digit is used to determine the general category. The remaining two digits provide finer detail – for example, 404 (Not Found) and 410 (Gone) are both client errors, but 410 explicitly tells the client that the resource used to exist and is now permanently removed.
Common Status Codes You Will See
While there are dozens of defined codes, most web users and developers encounter a small subset regularly:
- 200 OK – The request succeeded. This is the normal response for a loaded web page or a successful API call.
- 301 Moved Permanently – The resource has permanently moved to a new URL. Browsers and search engines update their records.
- 302 Found – The resource is temporarily located elsewhere. The client should continue using the original URL for future requests.
- 400 Bad Request – The server could not understand the request due to malformed syntax.
- 401 Unauthorized – The request requires user authentication. It often appears when you need to log in.
- 403 Forbidden – The server understood the request but refuses to authorize it. The client does not have permission.
- 404 Not Found – The server cannot find the requested resource. This is the classic “page not found” error.
- 500 Internal Server Error – The server encountered an unexpected condition that prevented it from fulfilling the request.
- 502 Bad Gateway – The server, acting as a gateway, received an invalid response from an upstream server.
- 503 Service Unavailable – The server is not ready to handle the request, often due to maintenance or overload.
These ten codes cover the vast majority of responses you will see in browser developer tools, server logs, and API debugging.
How to Read a Status Code in Practice
When you open your browser’s developer tools (usually F12) and go to the Network tab, every request shows its status code. A green 200 means success, a yellow 3xx means a redirect is happening, and red 4xx or 5xx indicates an error. For APIs, the status code is returned in the HTTP response header, separate from the response body (which often contains a JSON error message).
To troubleshoot a specific code:
- Identify the exact code from the network tab or server log.
- Look up its standard meaning – the code is defined by the HTTP specification (RFC 7231 for HTTP/1.1).
- Check the response body for a more detailed error message – many servers include a human-readable explanation.
- For 4xx errors, verify the URL, authentication headers, and request payload.
- For 5xx errors, check server logs and upstream services.
Common Misconceptions and Mistakes
One frequent misunderstanding is that 401 and 403 are interchangeable. 401 means you are not authenticated – the server does not know who you are. 403 means you are authenticated but not allowed to access the resource. For example, a logged-in user without admin rights might get 403 when trying to access an admin panel.
Another mistake is assuming a 301 and 302 are the same. 301 is permanent and tells search engines to transfer all ranking signals to the new URL. 302 is temporary and keeps the original URL indexed. Using the wrong one can harm SEO.
Also, many people think a 404 always means the page does not exist. It can also be returned deliberately to hide the existence of a resource (e.g., to prevent enumeration of private files). Conversely, a 200 does not guarantee the content is correct – it only means the server responded successfully.
Alternatives and Related Concepts
HTTP status codes are not the only way servers communicate errors. Some APIs use custom error codes inside the response body, allowing more granular error handling than the standard HTTP codes. GraphQL, for example, often returns 200 OK with a JSON body containing an “errors” array, because a single request can partially succeed and partially fail.
WebSocket connections have their own close codes (e.g., 1000 for normal closure), which are separate from HTTP status codes. And in server-side development, frameworks like Express or Django provide middleware to map exceptions to appropriate HTTP codes.
For developers, understanding the difference between 4xx and 5xx is crucial: 4xx errors are the client’s responsibility to fix, while 5xx errors indicate a server-side problem that needs server-side debugging.
Frequently Asked Questions
What does 404 mean?
404 Not Found means the server could not find the requested resource. It is a client error, so the URL is likely wrong, the resource was moved without a redirect, or the server is hiding it intentionally.
What is the difference between 401 and 403?
401 Unauthorized means you need to authenticate – you have not provided valid credentials. 403 Forbidden means you are authenticated but do not have permission to access the resource. A common example: 401 when you are logged out, 403 when you are logged in as a non-admin.
What should I do if I see a 500 Internal Server Error?
A 500 error means the server encountered an unexpected condition. Check the server logs for a stack trace, verify that any databases or external services are running, and look at recent code changes. If you are a user, try again later or contact the site owner.
Why do I sometimes see 200 but the page looks broken?
A 200 only means the server responded successfully. The page may contain client-side errors (JavaScript), missing assets (which would show their own 404s), or the server may have returned a cached or fallback version. Check the console and network tabs for other errors.
What is a 301 redirect and why does it matter for SEO?
A 301 Moved Permanently tells search engines that a page has permanently moved to a new URL. This passes most of the original page’s ranking power to the new URL. Using 302 for a permanent move can cause search engines to keep indexing the old URL, hurting your rankings.
Related
Formula used
in t | Response time | ms | 250 | 0 in s | Status code | - | 404 | 0 out code_class | Code class | - | floor(s / 100) | 0 out meaning | Meaning | - | "See table below" | 0
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.