Cheat sheet: HTTP status codes

What the numbers mean when a web server replies, grouped by family, with the ones you will actually troubleshoot.

The first digit tells you the family: 1xx information, 2xx success, 3xx redirect, 4xx the request has a problem, 5xx the server has a problem.

2xx: it worked

Code Name Meaning
200 OK The request worked and here is the result
201 Created Something new was created (typical for a POST)
204 No Content Worked, with nothing to send back

3xx: look somewhere else

Code Name Meaning
301 Moved Permanently The address changed for good. Update your links
302 Found Temporary redirect
304 Not Modified Your cached copy is still good
307 and 308 Temporary and Permanent Redirect Like 302 and 301 but the method (GET, POST) must stay the same

4xx: the request is the problem

Code Name What to check
400 Bad Request Malformed request: bad JSON, a missing field, a wrong format
401 Unauthorized Not signed in (or the credentials are wrong)
403 Forbidden Signed in but not allowed. Check permissions
404 Not Found Wrong address, or the thing was deleted
405 Method Not Allowed You used GET where POST is needed, or the reverse
408 Request Timeout The client took too long to send the request
409 Conflict The request clashes with the current state (for example a duplicate)
413 Content Too Large The upload is bigger than the server accepts
422 Unprocessable Content The request was understood but its content is invalid
429 Too Many Requests You hit a rate limit. Slow down and retry later

5xx: the server is the problem

Code Name What it usually means
500 Internal Server Error The application crashed. Read its logs
501 Not Implemented The server does not support that feature
502 Bad Gateway A proxy or load balancer got a bad answer from the server behind it
503 Service Unavailable Overloaded or down for maintenance. Often temporary
504 Gateway Timeout A proxy waited too long for the server behind it

Telling the common ones apart

  • 401 vs 403: 401 means “who are you?”; 403 means “I know who you are and the answer is no”.
  • 502 vs 504: 502 is a wrong answer from behind the proxy; 504 is no answer in time.
  • Redirect loops (the browser says “too many redirects”): two rules send the visitor back and forth, often HTTP to HTTPS and back.

Test from the command line

curl -I https://example.com          # headers only, shows the status
curl -s -o /dev/null -w "%{http_code}\n" https://example.com