Understanding HTTP Status Codes: A Reference Guide for Developers
HTTP status codes are the vocabulary servers use to tell clients what happened with a request. Knowing them well — not just the famous ones like 404 — makes debugging faster and helps you build applications that communicate more clearly with the clients consuming them. Here's a practical reference.
The Five Categories
Status codes are grouped by their first digit, which immediately tells you the general nature of the response:
- 1xx (Informational): Request received, processing continues. Rarely relevant to everyday debugging.
- 2xx (Success): The request succeeded.
- 3xx (Redirection): Further action needed to complete the request, usually meaning "go here instead."
- 4xx (Client Error): Something about the request itself was wrong.
- 5xx (Server Error): The server failed to fulfill a valid request.
The 2xx Codes Worth Knowing
- 200 OK — Standard success response.
- 201 Created — A new resource was successfully created (common after a POST request).
- 204 No Content — Request succeeded but there's no body to return (common for DELETE requests).
The 3xx Codes Worth Knowing
- 301 Moved Permanently — This resource has permanently moved to a new URL; search engines will transfer ranking signals to the new location.
- 302 Found (Temporary Redirect) — The resource is temporarily at a different URL; unlike a 301, this doesn't pass SEO value the same way and shouldn't be used for permanent moves.
- 304 Not Modified — Tells the browser the cached version it already has is still valid, saving bandwidth by not re-sending unchanged content.
A common mistake: using a 302 for what's actually a permanent redirect (like a domain migration), which can cause search engines to keep both URLs indexed rather than consolidating ranking signal onto the new one.
The 4xx Codes Worth Knowing
- 400 Bad Request — The request was malformed in some way the server couldn't understand or process.
- 401 Unauthorized — Authentication is required and either missing or invalid. (Despite the name, this is about authentication, not authorization.)
- 403 Forbidden — The server understood the request but refuses to authorize it — the client is authenticated but doesn't have permission.
- 404 Not Found — The requested resource doesn't exist at this URL.
- 429 Too Many Requests — Rate limiting has kicked in; the client is sending requests too quickly.
The 401 vs 403 distinction trips up a lot of developers: 401 means "we don't know who you are" (or your credentials are invalid), while 403 means "we know who you are, but you're not allowed to do this."
The 5xx Codes Worth Knowing
- 500 Internal Server Error — A generic catch-all for unexpected server-side failures.
- 502 Bad Gateway — A server acting as a gateway or proxy got an invalid response from an upstream server (common in reverse proxy setups where the backend application server crashed or isn't responding).
- 503 Service Unavailable — The server is temporarily unable to handle the request, often due to maintenance or being overloaded.
- 504 Gateway Timeout — Similar to 502, but specifically means the upstream server took too long to respond.
The distinction between 502 and 504 is genuinely useful for debugging: a 502 usually means the backend crashed or returned garbage, while a 504 means the backend was reachable but simply too slow — pointing you toward different root causes (a crash versus a performance problem).
Why Getting Status Codes Right Matters for SEO
Search engines rely heavily on status codes to understand your site's structure. Returning a 200 status code for a page that's actually an error message (a "soft 404") confuses crawlers into indexing broken pages as legitimate content. Similarly, using 302 redirects for permanent moves, as mentioned above, can dilute your SEO signal transfer compared to using the correct 301.
Why This Matters for API Design
If you're building an API, using status codes correctly (rather than always returning 200 with an error message buried in the response body) makes your API significantly easier for other developers to integrate with and debug, since standard HTTP tooling and libraries can handle errors based on status code alone without needing to parse response bodies to determine success or failure.
The Bottom Line
Status codes are a compact, standardized way for servers to communicate exactly what happened with a request. Using them correctly — not just defaulting to 200 or 500 for everything — makes debugging faster for you, and makes your site or API easier for both search engines and other developers to work with correctly.
