HTTP Status Code Cheat Sheet (1xx-5xx)

A practical reference for HTTP status codes — not just the textbook definition but real-world guidance: which code is right for "user tried to access something they don't own" (403 vs 404), when 422 makes sense over 400, the difference between 502 and 503. Searchable by code or use case.

How to use the HTTP Status Code Cheat Sheet (1xx-5xx)

Browse or filter by code, name, or use case. Each entry has the standard definition plus a "when to use" note and common alternatives to consider.

Choosing the right status code

HTTP status codes have crisp definitions but blurry edges in practice. Should a request for a resource the user does not own return 403 or 404? Is a validation failure a 400 or a 422? What separates a 502 from a 503? The textbook RFC text rarely answers these, and picking the wrong code makes an API harder to consume and debug.

This is a practical reference: every code with its IANA category, a plain “when to use” note, and the common alternatives worth considering, all searchable by number or by intent. For a fast single-code lookup when you already know the number, the HTTP status lookup is quicker; to understand the headers that travel with a response, see the HTTP headers explainer.

Common use cases

  • API design — pick the most accurate code for each response.
  • Settling debates — decide 403 versus 404, or 400 versus 422.
  • Code review — check that handlers return sensible statuses.
  • Debugging — understand what a code your client received implies.
  • Learning — browse the full range with real-world guidance.

Frequently asked questions

Should I use 403 or 404 for a forbidden resource?

Use 403 when the user is authenticated but not allowed; some APIs return 404 instead to avoid revealing that the resource exists at all.

When is 422 better than 400?

400 means the request was malformed; 422 means it was well-formed but failed validation, which is more precise for a valid JSON body with bad values.

What is the difference between 502 and 503?

502 means an upstream server returned an invalid response; 503 means the server itself is temporarily unavailable, often during overload or maintenance.

I just need to look up one code

Use the HTTP status lookup for a quick single-code answer.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: