Switch tool

HTTP Status & MIME Cheat-Sheet

Searchable HTTP status code & MIME type cheat-sheet, color-coded by class with click-to-copy.

Showing 62 / 62 · click a row to copy

CodeReason phraseDescription
100ContinueRequest received; client may continue.
101Switching ProtocolsServer is switching protocols per Upgrade header.
102ProcessingRequest received but still processing (WebDAV).
103Early HintsPreload hints sent before final response.
200OKRequest succeeded.
201CreatedResource created successfully.
202AcceptedRequest accepted, processing not finished.
203Non-Authoritative InformationReturned meta is from a copy, not origin.
204No ContentSuccess but no body returned.
205Reset ContentReset the document view.
206Partial ContentRange request fulfilled partially.
207Multi-StatusMultiple status codes for sub-requests (WebDAV).
208Already ReportedBinding members already enumerated (WebDAV).
226IM UsedResponse is an instance-manipulation result.
300Multiple ChoicesMultiple representations available.
301Moved PermanentlyResource moved permanently to a new URL.
302FoundResource temporarily under a different URL.
303See OtherRetrieve the resource via GET at another URL.
304Not ModifiedCached copy still valid; not modified.
305Use ProxyResource must be accessed through a proxy.
307Temporary RedirectTemporary redirect; keep request method.
308Permanent RedirectPermanent redirect; keep request method.
400Bad RequestMalformed request syntax.
401UnauthorizedAuthentication required or failed.
402Payment RequiredReserved for future payment use.
403ForbiddenAuthenticated but not allowed.
404Not FoundResource not found.
405Method Not AllowedHTTP method not allowed for this resource.
406Not AcceptableNo representation matches Accept headers.
407Proxy Authentication RequiredMust authenticate with the proxy first.
408Request TimeoutServer timed out waiting for the request.
409ConflictRequest conflicts with current state.
410GoneResource permanently removed.
411Length RequiredContent-Length header required.
412Precondition FailedA request precondition failed.
413Payload Too LargeRequest body too large.
414URI Too LongRequest URI too long.
415Unsupported Media TypeMedia type not supported.
416Range Not SatisfiableRequested range cannot be satisfied.
417Expectation FailedExpect header cannot be met.
418I'm a teapotJoke code from RFC 2324 (April Fools).
421Misdirected RequestRequest sent to a server that cannot respond.
422Unprocessable EntitySemantic errors in request (validation).
423LockedResource is locked (WebDAV).
424Failed DependencyDepends on a failed request (WebDAV).
425Too EarlyServer unwilling to risk replay.
426Upgrade RequiredClient must switch to a different protocol.
428Precondition RequiredRequest must be conditional.
429Too Many RequestsRate limit exceeded.
431Request Header Fields Too LargeHeader fields too large.
451Unavailable For Legal ReasonsBlocked for legal reasons.
500Internal Server ErrorGeneric server error.
501Not ImplementedServer lacks the requested functionality.
502Bad GatewayInvalid response from upstream server.
503Service UnavailableServer overloaded or under maintenance.
504Gateway TimeoutUpstream server timed out.
505HTTP Version Not SupportedHTTP version not supported.
506Variant Also NegotiatesContent negotiation config error.
507Insufficient StorageServer out of storage (WebDAV).
508Loop DetectedInfinite loop detected (WebDAV).
510Not ExtendedFurther extensions required.
511Network Authentication RequiredClient must authenticate to gain access.

How to use

Purpose

HTTP status code reference covering 1xx / 2xx / 3xx / 4xx / 5xx (100 Continue through 511 Network Authentication Required). For each code: official meaning, when to return it, how clients should handle it. Distinguishes common vs obscure codes, RESTful API recommended usage, browser-behavior relationship. Common for API design reference, endpoint error triage, interview review, HTTP protocol learning. Data stored locally, no network calls.

Steps

  1. Input a code (200/404) or browse by category
  2. Right pane shows official definition + meaning + when returned
  3. Common-level marking: very high (200/404/500), common (401/403/502), obscure (418/451)
  4. RESTful usage: which codes each verb (GET/POST/PUT/DELETE) typically returns
  5. Client handling: what frontend should do for each code
  6. Related RFCs: RFC 7231 / 9110 references
  7. Similar code comparisons: 401 vs 403, 301 vs 302, 502 vs 504
  8. One-click copy code + description

FAQ

401 vs 403?
401 Unauthorized: not logged in or token expired. Client should redirect to login. 403 Forbidden: logged in but no permission. Client should show "no permission" — relogin will not help. Naming is misleading: 401 should have been "Unauthenticated", 403 is the real "Unauthorized".
301 vs 302 — which is permanent?
301 Moved Permanently: permanent redirect; browsers cache the new location (skipping the old next time). 302 Found: temporary; always goes through the old URL. SEO: 301 transfers SEO weight to the new URL, 302 does not. Use 301 for domain change / permanent moves; 302 for A/B testing or temporary maintenance.
502 vs 504?
502 Bad Gateway: upstream returned an invalid response (service crashed, protocol error). E.g., PHP-FPM behind nginx is down → 502. 504 Gateway Timeout: upstream did not respond in time. 502 is usually a process issue (restart service); 504 is upstream slowness (check slow queries / network).
POST creating a resource — return 200 or 201?
RESTful recommends 201 Created (explicit "creation success"), with a Location header pointing to the new resource URI. Returning 200 is common too ("success without emphasizing creation"). Strict REST projects use 201; business-first projects either is fine — be consistent within the team.
Why do some APIs return 200 with error info in the body?
Anti-REST design. Arguments for: 1) browsers handle 4xx/5xx specially (some scenarios do not enter success callback); 2) China mobile-app history; 3) custom error codes richer than HTTP status. REST counterargument: HTTP status codes exist precisely for success/failure semantics. In practice, depends on team / business — RESTful designs integrate more smoothly with third parties.

Use cases

  • API design: decide which code to return on failure
  • Endpoint triage: API returns 5xx, look up what it means
  • Frontend error handling: decide what to show the user per code
  • Interview review: common HTTP code questions
  • Teaching: explain HTTP codes to newcomers

Use cases

API design, endpoint triage, frontend error handling, interview review, HTTP teaching. Backend, frontend, QA, support, interviewees. Common-level marking, RESTful recommendation, similar-code comparison, client-handling guidance are the differentiators.