Every HTTP response carries a three-digit status code that tells the client what happened. Browsers, search engines, mobile apps and API clients read that number before they read anything else, so choosing the right one is a design decision rather than trivia. This guide covers the five classes, the codes you meet daily, and how redirects and errors influence SEO.
The five classes
- 1xx Informational — the exchange is still in progress; 101 Switching Protocols upgrades a connection to WebSocket.
- 2xx Success — 200 OK, 201 Created, 204 No Content: the request worked as intended.
- 3xx Redirection — 301, 302 and 304 send the client elsewhere, or say nothing has changed since the last request.
- 4xx Client error — the request itself is wrong: 400, 401, 403, 404, 429.
- 5xx Server error — a valid request met a server that failed: 500, 502, 503, 504.
The codes you will actually meet
| Code | Meaning | What it signals |
|---|---|---|
| 200 | OK | Normal successful response |
| 301 | Moved Permanently | Permanent move; ranking signals pass to the new URL |
| 302 | Found | Temporary redirect; the old URL stays canonical |
| 304 | Not Modified | Use the cached copy; saves bandwidth |
| 400 | Bad Request | Malformed payload, missing field or broken query string |
| 401 | Unauthorized | No credentials, or the token has expired |
| 403 | Forbidden | Authenticated, but not allowed to this resource |
| 404 | Not Found | The resource genuinely does not exist |
| 500 | Internal Server Error | An unhandled exception or bug on the server |
| 503 | Service Unavailable | Overloaded, down for maintenance or shutting down |
Redirects, soft 404s and SEO
Search engines follow a single redirect happily; chains of three or four waste crawl budget and add latency to every visit. Use 301 for permanent moves, because it passes ranking signals to the destination, and 302 only when the swap is genuinely temporary. A soft 404 — an error page that returns 200 — teaches the crawler that a missing product is perfectly fine, and the URL can stay indexed for months. Return a real 404 or 410 for content that is gone, and a 301 when a close replacement exists.
Choosing codes for an API
Consistency beats completeness: pick a small documented set and stick to it. 400 for validation failures, 401 when credentials are missing, 403 when the caller lacks permission, 404 when the record does not exist, 409 for conflicts, 429 for rate limits, and 500 only for genuine faults. Reserve 503 with a Retry-After header for planned outages. Check any code before you invent one with the HTTP Status Codes Reference.
Frequently asked questions
Is 401 different from 403? Yes. 401 means "who are you?" and expects you to authenticate; 403 means "I know who you are, and the answer is no." Sending credentials again will not change a 403.
Should a deleted page return 404 or 410? 410 means gone permanently and tells crawlers to drop the URL faster. Use 404 when the absence might be temporary or you are unsure.
Do 5xx errors hurt rankings? Prolonged 500s and 503s do — Google may drop pages it cannot crawl reliably. A brief spike recovers quickly once responses return to 200.