Last reviewed:
What is an HTTP status code?
Every HTTP response starts with a three-digit status code that tells the client how the request went, before it reads any headers or body. The first digit gives the class: 1xx informational responses are interim messages, 2xx means success, 3xx asks the client to go somewhere else (redirects and cache revalidation), 4xx means the client made an error, and 5xx means the server failed to handle a valid request. Each code also has a reason phrase such as Not Found, but clients are meant to act on the number. HTTP/2 and HTTP/3 do not send the phrase at all.
The core codes are defined in RFC 9110, HTTP Semantics, published in 2022. It replaced the older RFC 7231 family and renamed some codes: 413 is now "Content Too Large" and 422, previously a WebDAV-only code, is "Unprocessable Content" for general use. Other codes come from extension RFCs, such as 429 Too Many Requests (RFC 6585), 451 Unavailable For Legal Reasons (RFC 7725) and the WebDAV codes 207, 423 and 507 (RFC 4918).
Picking the right code matters more than it looks. Browsers, caches, search engines, load balancers, SDK retry logic and monitoring all act on the code without reading your error message. A 200 with {"error": "not found"} in the body gets cached and indexed. A 500 for a validation problem gets retried pointlessly and wakes up the on-call engineer. The right code lets every layer behave correctly.
How to use this tool
- Browse the list, which is grouped by class with each class's name as a heading. Every card shows the code, its reason phrase, a plain-language explanation and the specification that defines it.
- Type in the search box to filter. A number matches codes that start with it, so
5shows all server errors and40shows 400 to 410. Words match the name, the explanation or the class name, sotimeout,cacheorredirectwork. - Use the All, 1xx, 2xx, 3xx, 4xx and 5xx buttons to restrict the list to one class. The count next to them shows how many codes match.
- Link to a code directly with a hash in the URL, such as
…/http-status-codes/#429. The page opens with that code already searched.
Examples
Searching the list
Search Result
40 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410
timeout 408 Request Timeout, 504 Gateway Timeout
rate limit 429 Too Many Requests
nginx 502 Bad Gateway
408 and 504 are both timeouts but mean opposite things: 408 says the client was too slow sending its request; 504 says a proxy gave up waiting for the upstream server.
Conditional request returning 304
A client that cached a response with an ETag sends it back on the next request:
GET /api/products/42 HTTP/1.1
Host: shop.example
If-None-Match: "v7-3f2a"
If the resource has not changed, the server replies with no body:
HTTP/1.1 304 Not Modified
ETag: "v7-3f2a"
Cache-Control: max-age=60
The client reuses its cached copy, saving the transfer.
Rate limiting with 429
HTTP/1.1 429 Too Many Requests
Retry-After: 30
Content-Type: application/json
{"error": "rate_limited", "message": "Limit of 100 requests per minute exceeded"}
Retry-After is either a number of seconds, as here, or an HTTP date. Well-behaved clients wait at least that long before retrying.
Common errors and how to fix them
- 401 when you mean 403. 401 means "we do not know who you are": the credentials are missing or invalid, and logging in may help. 403 means "we know who you are, and you may not do this". Return 401 with a
WWW-Authenticateheader for bad tokens, and 403 for permission failures. - 200 with an error body. Clients, caches and monitoring see success. Return a 4xx or 5xx status code and put the details in the body.
- 400 versus 422. Use 400 when the request cannot be parsed (malformed JSON, wrong types) and 422 when it parses but fails validation rules (an invalid email, an end date before the start date). Many APIs use 400 for both; the key is to be consistent.
- 302 for a permanent move. Search engines treat 302 as temporary and keep the old URL. Use 301, or 308 when the method and body must be preserved, for permanent moves.
- POST becoming GET after a redirect. Clients may change POST to GET when following 301 or 302. Use 307 or 308 if the request must be repeated as a POST.
- 500 for every failure. Reserve 500 for unexpected bugs. Use 503 with
Retry-Afterfor planned maintenance or overload, and 4xx codes for problems with the request. - 502 or 504 that the app never logged. These come from a proxy or load balancer, not the application. Check whether the upstream service was down (502) or too slow for the proxy's timeout (504).
When developers use this
- Choosing status codes while designing a REST API, for example 201 with a
Locationheader after a create, 204 after a delete, and 409 for a duplicate. - Diagnosing an unfamiliar code from a third-party API, a CDN or a browser network tab.
- Reviewing redirect rules during a site migration to make sure permanent moves use 301 or 308.
- Deciding which responses a client should retry: usually 408, 429, 502, 503 and 504, with backoff, but not most other 4xx codes.
- Writing alerting rules that separate client errors from server errors.
Privacy and how it works
The list of codes is part of the page, and searching filters it in your browser. Nothing you type is sent anywhere, and no requests are made to check status codes on other sites.
Limitations
- The list covers the codes registered with IANA and in common use: 61 in total. Retired or unused codes such as 305 Use Proxy and 306 are left out.
- Vendor-specific codes are not included. Examples are nginx's 499 (client closed the request) and Cloudflare's 520-527 range, which you will see in logs but which are not part of any HTTP standard.
- Explanations describe the standard meaning. Individual APIs sometimes use codes differently, so check their documentation.
FAQ
What is the difference between 401 and 403?
401 Unauthorized means the request has no valid authentication; sending correct credentials may succeed. 403 Forbidden means the server identified you and refuses anyway, so retrying with the same credentials will not help.
Should I return 404 or 403 for a resource the user cannot see?
If revealing that the resource exists would leak information, such as another customer's order ID, return 404. GitHub does this for private repositories. Otherwise 403 gives a clearer message to legitimate users.
When should I use 201 instead of 200?
Use 201 Created when a request creates a new resource, typically a POST, and include a Location header with its URL. Use 200 when the request succeeded without creating anything, or 204 when there is nothing to return.
What is the difference between 301 and 308?
Both are permanent redirects. With 301, clients may switch a POST to GET when following the redirect; with 308 they must repeat the original method and body. For ordinary page moves, 301 is fine; for API endpoints that receive POSTs, use 308.
Is 418 I'm a teapot a real status code?
It comes from an April Fools' RFC (RFC 2324) about controlling coffee pots and was never part of HTTP itself. It is reserved so that nothing else reuses the number, and some servers return it as a joke or to turn away suspected bots.
Which status codes should a client retry?
Retry 408, 429, 502, 503 and 504 after a delay, respecting any Retry-After header and backing off between attempts. Do not retry other 4xx errors unchanged, and only retry non-idempotent requests like POST if the API supports idempotency keys.
Why does my browser show a status code my server never sent?
A proxy, CDN, load balancer or browser extension in between may have generated it. Codes such as 502, 504 and vendor-specific ones like Cloudflare's 52x are produced by intermediaries, so check their logs as well as your application's.