HTTP Status Code Reference

Search every HTTP status code with plain-English explanations.

A searchable reference of HTTP status codes with plain-English explanations. Type a number or a word like "redirect" or "timeout", or filter by class, from 1xx informational through 5xx server errors. It's the quickest way to settle whether you want a 301 or a 302, or a 401 or a 403.

How to use it

  1. Type a code or keyword in the search box.
  2. Optionally pick a class.
  3. Read the explanation for each match.
  4. Keep it open while you debug.

When it helps

  • Working out why an API returned something unexpected.
  • Choosing the right code for your own responses.
  • Learning how the web works.
  • Understanding errors users report.

Good to know

  • 301 is a permanent move, 302 a temporary one, and 307 and 308 keep the original request method.
  • 401 means you haven't proved who you are; 403 means you have, and you're still not allowed.
  • A 5xx means the problem is on the server side, not with your request.

The five classes

Status codes are grouped by their first digit. 1xx codes are informational and rarely seen. 2xx means success. 3xx means the client must take further action, usually following a redirect. 4xx means the client made a mistake, and 5xx means the server failed to fulfil a valid request.

Knowing the class tells you a lot even if you don't know the exact code.

Worked example: debugging an API call

A request returns 401. That means you aren't authenticated, so check your token. A 403 means you're identified but not allowed, so check permissions. A 404 may mean the wrong URL, or that the server hides forbidden resources. A 429 means you're sending too many requests, so slow down and check the Retry-After header.

For 500, the fault is on the server, and the response body or server logs usually give the clue.

Choosing codes for your own API

Use 200 for success, 201 when you create something, 204 when there's nothing to return, 400 for malformed input, 401 and 403 for authentication and permission failures, 404 for missing resources, 409 for conflicts, 422 for validation errors, and 500 for unexpected failures.

Consistent use makes your API easier to work with. Return a helpful message body alongside the code.

Status codes and search engines

Search engines read status codes. A 200 page can be indexed, a 301 passes ranking to the new address, a 404 or 410 tells them a page is gone, and repeated 5xx errors can cause pages to drop out of results. Soft 404s, pages that say not found but return 200, confuse crawlers.

Return the right code for each situation, and use redirects when you move or merge pages.

Questions

What does 404 mean?

The server can't find the resource at that address.

What's 418?

I'm a teapot, a joke code from an April Fools' specification.