HTTP Status Codes

Free

Every status code, what it means, when to use it

All 46 HTTP status codes in one table

1xx informational, 2xx success, 3xx redirection, 4xx client error, 5xx server error. Definitions follow RFC 9110. Show the table
CodeNameMeaningWhen to use it
100ContinueThe request headers were received and the client should send the body.Only in response to a request carrying Expect: 100-continue. It lets a client avoid uploading a large body that the server was going to reject anyway - useful for multi-gigabyte uploads, invisible everywhere else. (RFC 9110 §15.2.1)
101Switching ProtocolsThe server is switching to the protocol the client asked for in Upgrade.The WebSocket handshake, essentially always. If you are writing this by hand you are implementing a protocol upgrade; if you are using a WebSocket library it has already done it. (RFC 9110 §15.2.2)
102ProcessingThe server has accepted the request but has not completed it (WebDAV).Deprecated in practice - it was removed from the WebDAV spec's successor guidance because no client did anything useful with it. Use 202 for an accepted-but-unfinished job. (RFC 2518 (obsoleted))
103Early HintsPreliminary headers sent before the final response, usually Link: rel=preload.A genuine performance win on a slow backend: the browser starts fetching CSS and fonts while your server is still assembling the HTML. Requires HTTP/2 or HTTP/3 in practice, and a CDN that forwards it. (RFC 8297)
200OKThe request succeeded and the body is the result.The default success. One thing worth getting right: a successful request that found nothing is still 200 with an empty list - an empty collection is not a 404. 404 means the *endpoint or resource* does not exist, not that a query matched no rows. (RFC 9110 §15.3.1)
201CreatedThe request succeeded and created a resource.A POST or PUT that created something. Send a Location header pointing at the new resource - that is the part almost everybody omits, and it is what makes 201 more informative than 200. (RFC 9110 §15.3.2)
202AcceptedThe request was accepted for processing, which has not finished.Any asynchronous job: the correct code for 'we queued it'. Return an identifier and a polling URL, because a 202 with no way to find out what happened is indistinguishable from a black hole. (RFC 9110 §15.3.3)
204No ContentSucceeded, and there is deliberately no body.A successful DELETE, or a PUT/PATCH where the client already has the new state. A 204 must not have a body - some clients will error if you send one, and proxies may strip it. (RFC 9110 §15.3.5)
206Partial ContentThe response carries the byte range the client asked for.Range requests - video seeking and resumable downloads. Requires Content-Range; sending 206 without it breaks every client. (RFC 9110 §15.3.7)
207Multi-StatusThe body contains per-operation statuses (WebDAV).Genuinely useful outside WebDAV for batch endpoints, but it is a trap for generic clients: an HTTP-level 2xx containing several failures means every naive if (response.ok) reports success. Prefer explicit per-item results in a 200. (RFC 4918 §11.1)
301Moved PermanentlyThe resource has a new permanent URL.A permanent URL change, and the only redirect that reliably passes SEO authority. Be certain: browsers cache 301s aggressively and for a long time, so a mistaken 301 can be effectively irreversible for returning visitors. Historically it also rewrites POST to GET. (RFC 9110 §15.4.2)
302FoundThe resource is temporarily at a different URL.Historically ambiguous - the spec says preserve the method, every browser changes POST to GET - which is exactly why 303 and 307 were introduced to say which you meant. For new code, use one of those. (RFC 9110 §15.4.3)
303See OtherRedirect to a resource that is not the request target, using GET.The POST-redirect-GET pattern: after a successful form submission, 303 to the result page so the browser does a GET and a refresh does not resubmit. This is the code most 302s should have been. (RFC 9110 §15.4.4)
304Not ModifiedThe client's cached copy is still fresh.In response to a conditional request (If-None-Match / If-Modified-Since). Send no body - that is the entire point, and the bandwidth saving is why ETags exist. (RFC 9110 §15.4.5)
307Temporary RedirectTemporarily elsewhere, and the method must not change.A temporary redirect where a POST must stay a POST. Use this instead of 302 whenever the method matters - it is the unambiguous version. (RFC 9110 §15.4.8)
308Permanent RedirectPermanently elsewhere, and the method must not change.The method-preserving 301. This is what an HTTP-to-HTTPS or trailing-slash redirect should use for an API, so a POST is not silently downgraded to a GET. (RFC 7538)
400Bad RequestThe server cannot process the request because of a client error.Malformed syntax: unparseable JSON, a missing required parameter, a value of the wrong type. If the request is well-formed but semantically wrong - a valid date that is in the past when it must be future - 422 says more. (RFC 9110 §15.5.1)
401UnauthorizedAuthentication is required and has failed or not been supplied.Not authenticated - we do not know who you are. Misnamed in the spec: it means unauthenticated. Must include WWW-Authenticate. If we know who you are and you still may not do this, that is 403. (RFC 9110 §15.5.2)
403ForbiddenThe server understood the request and refuses to authorise it.Authenticated but not permitted. Re-authenticating will not help, so do not send the client back to a login page. One deliberate exception: to avoid confirming that a resource exists to someone not allowed to see it, return 404 instead of 403. (RFC 9110 §15.5.4)
404Not FoundNo resource matches the request target.The resource or route does not exist. Not for an empty result set, and not for a failed validation. Also the right answer when you want to hide a resource's existence from an unauthorised caller. (RFC 9110 §15.5.5)
405Method Not AllowedThe target exists but does not support this method.A DELETE on a read-only collection. Must include an Allow header listing the methods that do work - without it, the client learns nothing it could act on. (RFC 9110 §15.5.6)
406Not AcceptableNothing the server can produce matches the request's Accept headers.Rare, and usually a mistake when it happens: most servers should ignore an unsatisfiable Accept and send their default representation rather than fail the request. (RFC 9110 §15.5.7)
409ConflictThe request conflicts with the current state of the resource.A duplicate that violates a uniqueness constraint, or an optimistic-concurrency failure where someone else edited the record first. The body should say what conflicted - 409 alone leaves the client with no next step. (RFC 9110 §15.5.10)
410GoneThe resource existed and has been permanently removed.Better than 404 when you know the resource is deliberately gone: crawlers drop a 410 much faster than a 404, and a client can distinguish 'deleted' from 'never existed'. (RFC 9110 §15.5.11)
411Length RequiredThe server refuses a body sent without a Content-Length header.Rare from your own code - proxies and some servers send it when a body arrives with neither Content-Length nor chunked encoding. Fix the client to send the length (or stream it chunked) rather than retrying. (RFC 9110 §15.5.12)
412Precondition FailedA conditional header on the request did not hold.The write-side companion to 304: If-Match with a stale ETag means somebody else changed the resource since you read it. This is how you get compare-and-swap over HTTP. (RFC 9110 §15.5.13)
413Content Too LargeThe request body is larger than the server will accept.An upload over your cap. Renamed from 'Payload Too Large' in RFC 9110. Say what the cap is in the body - a bare 413 makes the user retry the same file. (RFC 9110 §15.5.14)
414URI Too LongThe request target is longer than the server is willing to read.Usually a GET carrying data that belongs in a body - a huge filter or a base64 blob in the query string. Move it into a POST body; most servers cap the URL somewhere around 8 KB. (RFC 9110 §15.5.15)
415Unsupported Media TypeThe body's Content-Type is one the endpoint does not accept.XML posted to a JSON-only endpoint, or - much more often in practice - a missing Content-Type header entirely. (RFC 9110 §15.5.16)
416Range Not SatisfiableNone of the byte ranges in the Range header overlap the resource.A resumed download asking for bytes past the end of a file that has since shrunk or changed. Send Content-Range: bytes */<length> so the client can restart from a valid offset. (RFC 9110 §15.5.17)
417Expectation FailedThe server cannot meet the request's Expect header.Almost always Expect: 100-continue reaching a server or proxy that does not support it. Clients that get it should resend the request without the Expect header. (RFC 9110 §15.5.18)
418I'm a Teapotnot in a core RFCThe server refuses to brew coffee because it is, permanently, a teapot.Never, in production. An April Fools' joke from RFC 2324 (1998) that is now reserved by IANA specifically so nobody assigns it a real meaning. Included because people look it up. (RFC 2324 §2.3.2)
422Unprocessable ContentThe syntax is fine but the content is semantically wrong.The right code for a validation failure on a well-formed request: valid JSON, correct types, but the email is already taken or the end date precedes the start. 400 says 'I could not read this'; 422 says 'I read it and it is wrong'. (RFC 9110 §15.5.21)
423LockedThe resource is locked (WebDAV).WebDAV locking. Outside WebDAV, 409 communicates the same thing to more clients. (RFC 4918 §11.3)
428Precondition RequiredThe server requires the request to be conditional.To force clients into compare-and-swap: refuse an unconditional PUT so a client cannot blindly overwrite. Pairs with 412 and prevents the lost-update problem entirely. (RFC 6585 §3)
429Too Many RequestsThe client has sent too many requests in a given period.Rate limiting. Send Retry-After - without it a well-behaved client has to guess, and the usual guess is to retry immediately, which is precisely what you were trying to stop. (RFC 6585 §4)
431Request Header Fields Too LargeThe headers are collectively or individually too large.Almost always an oversized Cookie header in the wild - a session cookie that grew, or too many subdomain cookies. Worth naming explicitly because the cause is unobvious. (RFC 6585 §5)
451Unavailable For Legal ReasonsThe resource is blocked for legal reasons.Court-ordered takedowns and legally-mandated geo-blocking. The number is a Fahrenheit 451 reference and the RFC says so. Should carry a Link: rel="blocked-by" naming who required it. (RFC 7725)
500Internal Server ErrorThe server hit an unexpected condition.The honest answer for an unhandled exception, and it should be your least common 5xx: every 500 in a log is a bug you have not classified yet. Never leak a stack trace in the body - that is a real information-disclosure finding. (RFC 9110 §15.6.1)
501Not ImplementedThe server does not support the functionality required.A method the server does not recognise at all. Distinct from 405, which means 'this method exists but not on this resource'. (RFC 9110 §15.6.2)
502Bad GatewayAn upstream server returned an invalid response.From a proxy or load balancer when the origin is unreachable or spoke nonsense. If you are seeing this on your own deployment, the application process is usually not listening on the port the proxy expects. (RFC 9110 §15.6.3)
503Service UnavailableThe server is temporarily unable to handle the request.Maintenance windows and overload - the code that says 'come back'. Send Retry-After. Prefer this over 500 for a deliberate outage, because it tells crawlers not to de-index the page. (RFC 9110 §15.6.4)
504Gateway TimeoutAn upstream server did not respond in time.A proxy timing out on the origin. The important operational detail: the upstream request may well have succeeded after the proxy gave up, so a 504 on a non-idempotent call cannot be safely retried without an idempotency key. (RFC 9110 §15.6.5)
507Insufficient StorageThe server cannot store the representation needed to complete the request.WebDAV, and occasionally a genuinely full disk. Rare, and usually an alert rather than an API contract. (RFC 4918 §11.5)
508Loop DetectedThe server detected an infinite loop while processing the request.WebDAV Depth: infinity traversal that cycles. Almost never seen elsewhere. (RFC 5842 §7.2)
511Network Authentication RequiredThe client must authenticate to the network, not to the server.Captive portals - hotel and airport wifi. Intended so a client can tell 'the network is intercepting me' from 'the site is broken'. Widely ignored by the portals that should send it. (RFC 6585 §6)
How this works

About HTTP Status Codes

HTTP status codes are the three-digit numbers a server returns to say what happened to a request: 1xx informational, 2xx success, 3xx redirection, 4xx client error and 5xx server error. This list covers the 46 codes you will actually meet, each with what it means and when to use it, including 401 vs 403 and 400 vs 422. Free, and nothing you search leaves your browser.

Takes
A code, or a search for what you are trying to say
Returns
What it means, when to use it, and what to send instead
Handles
The pairs people get wrong - 401 against 403, 400 against 422, 301 against 307
Privacy
A static reference - no request is made when you search

Nothing you type leaves this page

This tool runs entirely in your browser. Nothing you type or paste is sent to Revquix or to anyone else, no account is needed, and the page keeps working with your network disconnected.

Full detail in our privacy policy and AI policy.

401 is not authorisation

The specification names 401 Unauthorized and means unauthenticated: we do not know who you are, so send credentials - which is why it must carry a WWW-Authenticate header. 403 Forbidden means the opposite situation: we know exactly who you are and you still may not do this, so re-authenticating will not help and sending the user to a login page is the wrong response.

Getting this backwards produces a specific, common bug: a client that redirects to login on a 403 puts a legitimately-authenticated user into an endless loop, because signing in again changes nothing. There is one deliberate exception worth knowing - where confirming that a resource exists would itself leak information, returning 404 to an unauthorised caller is the right answer rather than 403.

400 or 422

400 Bad Request means the request could not be read: unparseable JSON, a missing required field, a value of the wrong type. 422 Unprocessable Content means it was read perfectly and is still wrong - a well-formed email address that is already taken, an end date before its start date, a quantity larger than the stock.

The distinction is worth maintaining because it tells the client whether to fix its serialisation or to show the user a field error, and those are entirely different code paths.

The three redirects that are really six

302 is historically ambiguous: the specification says preserve the request method, every browser changes POST to GET. That ambiguity is why 303 and 307 exist - 303 See Other explicitly means redirect with GET, and 307 explicitly means keep the method. 308 is the permanent, method-preserving counterpart to 301.

For new work, prefer the explicit pair: 303 after a successful form POST so a refresh does not resubmit, and 307 or 308 whenever a POST must stay a POST. 301 remains the one that reliably passes search authority, and browsers cache it hard enough that a mistaken 301 is close to irreversible for returning visitors.

  • Search by number - typing 40 lists the whole 40x range
  • Or by symptom, including phrases like rate limit and forbidden vs unauthorized
  • Codes cacheable by default under RFC 9111 are marked
  • Codes registered with IANA but absent from a core RFC are labelled as such

What it will not do

It will not tell you which code your framework is actually returning, and that gap matters: a proxy, a CDN or an error handler in the middle can and does rewrite a status on the way out. Check the response over the wire rather than the code your handler thinks it set.

It is also not exhaustive. 46 codes are covered - the ones you will actually meet - and the WebDAV and unofficial extensions are included only where they are widely deployed or widely looked up. Inventing a status code for your own API is a non-goal for the same reason: clients and proxies only understand the registered ones.

FAQ

Questions people actually ask

The ones that come up before somebody pastes anything in.

What is the difference between 401 and 403?

401 means unauthenticated - we do not know who you are, so send credentials, and the response must include a WWW-Authenticate header. 403 means authenticated but not permitted, so re-authenticating will not help. Redirecting to login on a 403 creates a loop for a user who is already signed in.

Should a validation error be 400 or 422?

422 if the request was well-formed and the content is wrong - a duplicate email, an end date before its start. 400 if the request itself could not be read, such as malformed JSON or a missing required parameter. The distinction tells the client whether to fix its serialisation or to display a field error.

Which redirect preserves the HTTP method?

307 for a temporary redirect and 308 for a permanent one. 301 and 302 historically rewrite POST to GET despite what the specification says, and 303 does so deliberately. Use 303 after a form submission so a refresh does not resubmit, and 307 or 308 whenever a POST must remain a POST.

What does 429 Too Many Requests mean?

The client sent too many requests in a given period: it is the rate-limiting code (RFC 6585). Send a Retry-After header with it. Without one, a well-behaved client has to guess when to try again, and the usual guess is immediately, which is exactly the traffic the limit was meant to stop.

What is the difference between 502, 503 and 504?

502 Bad Gateway: a proxy got an invalid response from the server behind it, often because the application is not listening where the proxy expects. 503 Service Unavailable: the server is deliberately or temporarily unable to cope, as in maintenance or overload, and should send Retry-After. 504 Gateway Timeout: the proxy gave up waiting, and the request may still have succeeded upstream.

Which status code means a resource already exists?

409 Conflict, for a duplicate that breaks a uniqueness rule or an edit that lost an optimistic-concurrency race. Put what conflicted in the body, because 409 alone leaves the client with no next step. If the payload is well-formed but fails a business rule rather than colliding with existing state, 422 is the better fit.

Is an empty result a 404?

No. A successful query that matched nothing is 200 with an empty list - the endpoint exists and answered. 404 means the resource or route itself does not exist. Returning 404 for an empty collection forces every client to treat a normal outcome as an error.

Can I invent my own status code?

You can, and you should not. Clients, proxies and CDNs only reason about registered codes, and an unknown one is treated as the generic case for its class - so a made-up 499 behaves as an unspecified 4xx and communicates nothing. Put the detail in the response body instead.

Next, try one of these

More from Developer, or browse the full catalogue.

This is an interview question

“When would you return 403 rather than 401?”

API design rounds live on exactly these distinctions, and the difference between reciting a table and reasoning about a real endpoint is the whole assessment. A mock interview with an engineer who runs these rounds tells you which one you are doing.

Mock Interview from ₹400