Skip to main content

HTTP status codes list, and what a client does next

The HTTP status codes list in five classes, the codes a crawler meets most, and the next step a well-behaved client takes for each, checked against one dated crawl.

From our run on
  1. {"url": "https://the-internet.herokuapp.com/redirector",       "status": 200, "error": null},
  2. {"url": "https://the-internet.herokuapp.com/status_codes/200", "status": 200, "error": null},
  3. {"url": "https://the-internet.herokuapp.com/status_codes/404", "status": 404, "error": null},
  4. {"url": "https://the-internet.herokuapp.com/status_codes/301", "status": 301, "error": null},
  5. {"url": "https://the-internet.herokuapp.com/status_codes/500", "status": 500, "error": null}
Concept 7 min read

The HTTP status codes list runs from 100 to 599, and every code falls into one of five classes named by its first digit: 1xx informational, 2xx success, 3xx redirection, 4xx client error and 5xx server error. A client that knows the five classes can handle any code it receives, because the first digit already says whether to keep the page, follow a link, fix the request or wait.

The class rule is written into the standard. RFC 9110, the IETF document that defines HTTP semantics, says that "a client MUST understand the class of any status code, as indicated by the first digit, and treat an unrecognized status code as being equivalent to the x00 status code of that class." A 471 nobody has registered is read as a 400. You do not need to memorize sixty codes. You need the classes, plus a short list of the codes that change what you do next.

The five classes

This clip reads the five classes and then the codes a crawler meets most. The same rules follow it in the tables below.

What a status code asks you to do. 1 min 13 s, no sound. The words are on screen, and the captions button shows them at your own text size.
Read the transcript

What a status code asks you to do. Five classes, and the next step for each.

The first digit names the class. The class says what to do next. Status: 100 to 599, five classes. 1xx: Wait for the final response. 2xx: Keep the content. 3xx: Read the Location header.

Read an unknown code by its class. Out of range reads as 5xx. Status: Errors and bad codes. 4xx: Fix the request, or stop. 5xx: Wait, then try once more. 999: Treat it as a 5xx.

A permanent move changes your list. A temporary one does not. Status: Redirects. 301, 308: Store the new address. 302, 307: Keep the old address. 304: Reuse the copy you have.

A 404 is not proof that a page is gone. A 410 is. Status: Client errors. 404: Drop it. It may come back. 410: Drop it for good. 401, 403: Stop. Ask for access.

Both ask you to wait. Retry-After gives seconds or a date. Status: Slow down. 429: Wait out Retry-After. Send fewer. 503: Wait out Retry-After. Try again.

Read the full page. The page is at spider.cloud/learn/http-status-codes.

ClassWhat it meansWhat a client does next
1xxThe server got the request and is still working on it.Nothing. Wait for the final response.
2xxThe request worked.Keep the content.
3xxThe page is somewhere else, or your copy is still good.Read the Location header, or keep your cached copy on a 304.
4xxSomething about your request is wrong.Change the request, or stop asking for that address.
5xxThe server failed.Wait, then try once more. Slow down if it keeps happening.

The RFC adds one rule for numbers outside that range: "A client that receives a response with an invalid status code SHOULD process the response as if it had a 5xx (Server Error) status code." So a 999 from a broken server gets the same patience as a 500.

The codes a crawler meets most

CodeNameThe next step
200OKStore the page.
204No ContentNothing to store. Do not retry.
301Moved PermanentlyFollow Location and replace the old address in your list.
302FoundFollow Location, and keep the old address for next time.
304Not ModifiedReuse the copy you already have.
307Temporary RedirectFollow Location with the same method and body.
308Permanent RedirectFollow Location with the same method, and replace the old address.
400Bad RequestFix the request. Sending it again unchanged gets the same answer.
401UnauthorizedSign in, or leave the page alone.
403ForbiddenStop. Ask the site for access.
404Not FoundDrop the address, and check it again much later if it matters.
410GoneDrop the address for good.
429Too Many RequestsWait as long as Retry-After says, then send fewer requests.
500Internal Server ErrorTry once more after a pause.
502Bad GatewaySame as 500.
503Service UnavailableWait as long as Retry-After says, then try again.
504Gateway TimeoutSame as 500, with a longer pause.

What one crawl returned

Every web scraping run ends up sorting its pages by these codes, and they are easier to remember once you have seen them come back from a real site. The site at the-internet.herokuapp.com is a public practice site for test automation, and it has a page that links to a 200, a 301, a 404 and a 500, and a second page with a link that redirects. This request crawls from the redirect page and keeps to those two parts of the site, with a one second delay between pages and a user_agent that names the client. Set SPIDER_API_KEY to your key first.

curl -s https://api.spider.cloud/crawl \
  -H "Authorization: Bearer $SPIDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://the-internet.herokuapp.com/redirector", "limit": 10, "request": "http", "return_format": "text", "whitelist": ["/redirector", "/redirect", "/status_codes"], "user_agent": "examplebot/1.0 (+https://example.com/bot; bot@example.com)", "delay": 1000}'

The crawl ran on 2026-11-20 at 17:28 UTC and returned 7 pages in 12.9 seconds. This is each page's url, status and error, in the order they came back, with the content field left out.

[
  {"url": "https://the-internet.herokuapp.com/redirector",       "status": 200, "error": null},
  {"url": "https://the-internet.herokuapp.com/status_codes",     "status": 200, "error": null},
  {"url": "https://the-internet.herokuapp.com/status_codes/200", "status": 200, "error": null},
  {"url": "https://the-internet.herokuapp.com/status_codes",     "status": 200, "error": null},
  {"url": "https://the-internet.herokuapp.com/status_codes/404", "status": 404, "error": null},
  {"url": "https://the-internet.herokuapp.com/status_codes/301", "status": 301, "error": null},
  {"url": "https://the-internet.herokuapp.com/status_codes/500", "status": 500, "error": null}
]

Counted by status, the crawl came to this.

StatusPagesWhat a well-behaved client does next
2004Keeps all four.
3011Would follow Location and store the new address. This page sent none, so the client records the 301 and moves on.
4041Takes the address off the list.
5001Asks once more later.

Reading the tally

One page appears twice. /status_codes is in rows two and four, and the redirect is in no row at all. The link on /redirector points to /redirect, which sends the client on to /status_codes. The crawler followed it and recorded the page under the address where it landed, with a 200. We checked that by asking for /redirect on its own at 17:28 UTC, and the answer came back as /status_codes with a 200. A tally of final statuses undercounts redirects. If you need to know which of your stored links have moved, compare the address you asked for with the address you got back.

The 301 row is the other way round. That page answers with a 301 and a short body, and the crawl recorded the 301 itself. The practice page sets only the status and sends no Location header, so there was nothing to follow. A real 301 names its new address there. For a permanent move, RFC 9110 says "any future references to this resource ought to use one of the enclosed URIs." Following that address fixes the current run. Rewrite the stored address too, and the next run asks the right place first. A 302 asks for the opposite, and the RFC says "the client ought to continue to use the target URI for future requests."

The 404 is less final than it looks. RFC 9110 says "A 404 status code does not indicate whether this lack of representation is temporary or permanent". Its sibling 410 is the code a server sends when it knows "this condition is likely to be permanent." Drop a 404 from the next run, but do not treat it as proof the page is gone forever. Drop a 410 and do not ask again.

A 500 is a fault on the server. The RFC's definition is that "the server encountered an unexpected condition that prevented it from fulfilling the request." One more try after a pause is fair. A loop of instant retries puts more load on a server that is already failing. When many pages on one host return 5xx in a row, lower your request rate for that host before you try again.

The two codes that mean slow down

The crawl did not hit a 429 or a 503, and on a polite run it should not. When one arrives, it is the site asking you to wait. RFC 6585, which added 429, says "The 429 status code indicates that the user has sent too many requests in a given amount of time". The same section adds that the response "MAY include a Retry-After header indicating how long to wait before making a new request." RFC 9110 gives 503 the same header, there "to suggest an appropriate amount of time for the client to wait before retrying the request."

Retry-After holds either a number of seconds, such as 120, or an HTTP date. Handle both. Read the header and wait at least that long. Then come back at a lower rate than the one that got you the 429. If there is no header, pick a pause of your own and make it longer each time the code returns.

A 401 or a 403 means the site has said no to this request. For a 403, RFC 9110 says "The client SHOULD NOT automatically repeat the request with the same credentials." Sending the same request again will not change the answer. Check the site's robots.txt and its terms, and if the content is something you need, ask the owner for access. The robots.txt page covers which status codes on that one file change what you may fetch.

Do this, avoid this

Do this

  • Branch on the first digit of the status, and handle the codes in the table above by name.
  • Rewrite a stored address after a 301 or 308, and keep it after a 302 or 307.
  • On a 429 or 503, read Retry-After as seconds or as a date before you schedule the next try.
  • Compare the address you asked for with the address you got back, so redirects show up in your counts.

Avoid this

  • Retrying a 500 in a tight loop.
  • Repeating a 401 or 403 with the same credentials and hoping for a different answer.
  • Counting a 404 as proof that a page is gone for good.
  • Letting a status outside 100 to 599 pass as a success.

To test your own handling, point your client at the practice pages from the run above. /status_codes/200, /status_codes/301, /status_codes/404 and /status_codes/500 each answer with the code in their name, so every branch of your code has a known answer to check against.

Sources

  1. RFC 9110, HTTP Semantics, section 15, Status Codes, IETF, June 2022 Read
  2. RFC 6585, Additional HTTP Status Codes, IETF, April 2012 Read

Run this on a page you care about

The playground sends the request this page describes and shows you the response. Keyless runs work without an account and are rate limited.