An HTTP status code is the three-digit number that a server places at the start of every HTTP response to state the outcome of the request: success, redirection, a client error or a server error. Among Internet protocols, it is the primary signal that browsers, crawlers, API clients, proxies and caches use to decide what to do next with a response, independent of the content that follows.
Status codes are defined in RFC 9110, the current HTTP semantics specification, and are shared by HTTP/1.1, HTTP/2 and HTTP/3. The best-known example is 404 Not Found, so familiar that “404 error” has become a synonym for a missing page. Each code comes with a short reason phrase in HTTP/1.1, but only the number carries meaning for software, and HTTP/2 and HTTP/3 drop the phrase entirely.
How the five HTTP status code classes work
The first digit defines the class of the response, and the remaining two digits refine it. This design means that a client which does not recognize a specific code can still treat it as the generic x00 code of its class, so an unknown 299 is handled like 200 and an unknown 499 like 400.
| Class | Range | Meaning | Typical handling |
|---|---|---|---|
| Informational | 100-199 | Interim response, request continues | Wait for the final response |
| Successful | 200-299 | Request was received and accepted | Use the response body |
| Redirection | 300-399 | Further action needed elsewhere | Follow the Location header |
| Client error | 400-499 | Problem with the request itself | Fix the request, do not retry blindly |
| Server error | 500-599 | Server failed a valid request | Retry later or report the fault |
The status line appears before any HTTP header or body, so intermediaries such as load balancers, CDNs and monitoring systems can classify traffic without parsing the content. In HTTP/2 and HTTP/3, the code travels as the pseudo-header :status.
The status codes that matter most in practice
The IANA registry lists around sixty codes, but a small core set covers most real traffic. The table below summarizes the codes that web developers, administrators and API designers meet daily.
| Code | Name | When it is used |
|---|---|---|
| 200 | OK | Normal successful response |
| 201 | Created | A POST or PUT created a new resource |
| 204 | No Content | Success with an intentionally empty body |
| 301 | Moved Permanently | Resource has a new permanent URL |
| 304 | Not Modified | Cached copy is still valid |
| 400 | Bad Request | Malformed syntax or invalid input |
| 401 / 403 | Unauthorized / Forbidden | Missing credentials / access denied |
| 404 | Not Found | No resource exists at this URL |
| 429 | Too Many Requests | Client exceeded a rate limit |
| 500 / 503 | Internal Server Error / Service Unavailable | Unexpected fault / temporary overload or maintenance |
The naming of 401 Unauthorized is historically misleading: it actually means unauthenticated, and the response must include a WWW-Authenticate header. 403 Forbidden means the server knows who the client is but refuses access anyway.
Choosing the right redirect code
Redirect codes differ in two independent properties: whether the move is permanent and whether the client may change the request method. Choosing wrongly can turn a form submission into a plain GET or make search engines keep an outdated URL.
| Code | Permanence | Method preserved | Typical use |
|---|---|---|---|
| 301 | Permanent | Not guaranteed, POST often becomes GET | Domain or URL structure change |
| 302 | Temporary | Not guaranteed | Short-term redirect, legacy behavior |
| 303 | Temporary | Always becomes GET | Redirect after a form POST |
| 307 | Temporary | Yes | Temporary move of an API endpoint |
| 308 | Permanent | Yes | Permanent move that must keep POST |
For website migrations, 301 or 308 tells search engines to transfer indexing to the new URL. Browsers cache permanent redirects aggressively, sometimes indefinitely, so a mistaken 301 can be hard to undo for visitors who already received it.
Status codes in APIs, caching and search
In REST and JSON APIs, status codes form part of the contract between server and client. A frequent design flaw is returning 200 OK with an error message in the body, which hides failures from monitoring tools, retry logic and caches that rely on the code.
Caches treat codes differently: responses such as 200, 301, 404 and 410 are heuristically cacheable, while others need explicit freshness headers. Search crawlers also react to codes: 404 and 410 remove pages from the index over time, repeated 5xx errors slow down crawling, and a soft 404, an error page served with 200, wastes crawl budget and confuses indexing.
- Use 422 or 400 for validation errors, with a structured body describing the problem.
- Add Retry-After to 429 and 503 so clients know when to try again.
- Return 410 Gone when a resource is removed deliberately and will not return.
- Keep 500 for unexpected faults, not for predictable conditions the client caused.
Common misreadings of HTTP status codes
Several errors in diagnosis come from attributing a code to the wrong component. A 502 Bad Gateway or 504 Gateway Timeout is produced by a proxy or load balancer, which reports that the upstream application failed or did not answer in time; the application itself may never have logged the request.
| Observed code | Usual real cause | Where to look |
|---|---|---|
| 502 | Upstream crashed or sent an invalid response | Application process and proxy logs |
| 504 | Upstream exceeded the proxy timeout | Slow queries, timeout settings |
| 404 on existing page | Wrong routing or rewrite rule | Server configuration |
| 403 on static files | File permissions or WAF rule | File system and firewall logs |
Unofficial codes add to the confusion. Some servers and CDNs use nonstandard values such as 444, 499 or 520 for internal conditions; they are not part of the HTTP standard and should be interpreted using the documentation of the product that produced them.
A non-technical view
Every time a browser asks a website for a page, the website answers with a short number before anything else. That number is the HTTP status code. It works like the stamp a post office puts on a returned letter. One stamp means delivered. Another means moved to a new address. Another means nobody lives here.
The famous 404 means the page was not found. Numbers starting with 2 mean everything went well. Numbers starting with 5 mean the website itself had a problem. People rarely see these numbers, but programs read them constantly to decide what to do next.
A concrete example
An online magazine moves from old-magazine.example to a new domain and restructures its article URLs. The developers map every old address to its new one and return 301 Moved Permanently for each. Pages that were deliberately removed get 410 Gone, and the editorial search page answers with 303 See Other after a form submission.
In the first week after the switch, the monitoring dashboard shows a rise in 504 responses from the load balancer. Investigation reveals that a new image-processing service takes up to 70 seconds, while the proxy timeout is 60 seconds. After moving image processing to a background queue, the 504s disappear. Search engines transfer the old rankings to the new URLs within a few weeks, and readers following old links reach the right articles.