What do HTTP 3xx, 4xx and 5xx status codes mean?
What do the status code classes mean?
Every HTTP response starts with a three digit status code, and the first digit tells you the class:
- 1xx (100 to 199): informational responses
- 2xx (200 to 299): successful responses
- 3xx (300 to 399): redirection messages
- 4xx (400 to 499): client error responses
- 5xx (500 to 599): server error responses
A 3xx code tells the client to look somewhere else. A 4xx code means the server sees the problem in the request. A 5xx code means the server failed to handle a request that may have been perfectly valid.
What do 400 and 422 mean?
Both are client errors, but they describe different problems. A 400 Bad Request means the server would not process the request because of something it considered a client error, typically malformed request syntax, invalid message framing or deceptive request routing. MDN gives the example of a request whose JSON body is invalid.
A 422 Unprocessable Content means the server understood the content type and the syntax was correct, but it could not process the instructions the request contained. In other words, the request was well formed but its meaning was wrong, such as a field that fails validation. MDN says that for both codes, repeating the same request without changing it will fail with the same error, so the request itself needs correcting.
What are the common 4xx and 5xx errors?
The client errors you are most likely to meet on a website are:
- 403 Forbidden: the server knows who the client is but refuses access
- 404 Not Found: the server cannot find the requested resource
- 410 Gone: the content has been permanently deleted with no forwarding address
- 429 Too Many Requests: the client has sent too many requests in a given time
The server errors are:
- 500 Internal Server Error: a generic code for a situation the server does not know how to handle
- 502 Bad Gateway: a server acting as a gateway received an invalid response
- 503 Service Unavailable: the server is not ready, often because of maintenance or overload, and should send a Retry-After header if it can
- 504 Gateway Timeout: a gateway server could not get a response in time
What is the difference between 301, 302, 307 and 308?
A 301 means the URL has moved permanently and a 302 means it has moved temporarily. A 307 and a 308 carry the same temporary and permanent meanings, with one extra rule: the client must not change the HTTP method, so a POST stays a POST when it follows the redirect.
HTTP/1.1 308 Permanent Redirect
Location: https://example.com/new-pageGoogle groups 301 and 308 as permanent redirects and uses them as a signal that the target should be canonical, so the new URL is shown in results. It treats 302, 303 and 307 as temporary, so the original URL can stay in results. Use 301 or 308 when a page has moved for good, and 302 or 307 when the move is short term.
How does Google treat these codes?
Google's crawlers follow up to 10 redirect hops by default. Google does not use the content from URLs that return a 4xx code, and indexed URLs that return one are removed from the index. Apart from 429, 4xx codes have no effect on crawl rate. A 429 and any 5xx code tell Google's crawlers to slow down temporarily. URLs that keep returning a server error are eventually dropped from the index, and the crawl rate rises again once the server returns 2xx responses. A 2xx page that looks like an error page can be reported as a soft 404 in Search Console.
Sources
- MDN: HTTP response status codes
- MDN: 400 Bad Request
- MDN: 422 Unprocessable Content
- Google: How HTTP status codes affect Google's crawlers
- Google Search Central: Redirects and Google Search
Frequently asked questions
Should I return 404 or 410 for a page I have deleted?
Both are client error codes. MDN describes 404 as the server being unable to find the resource, while 410 means the content has been permanently deleted with no forwarding address. Google says it does not use content from URLs that return 4xx codes and removes indexed URLs that return them, so either code takes the page out of Google's index over time.
Does a 503 during maintenance hurt my rankings?
Google says 5xx and 429 errors make its crawlers slow down temporarily, and indexed URLs are kept for a while before being dropped if the errors continue. A short 503 during planned maintenance is the code MDN describes for temporary conditions, ideally with a Retry-After header. Google raises its crawl rate again once your server returns successful responses.