HTTP Status Codes
Every code with its meaning and cacheability
An HTTP status code is three digits whose first digit gives the class: 1xx informational, 2xx success, 3xx redirection, 4xx client error, 5xx server error. That grouping is the useful part — a client can behave sensibly on a code it has never seen simply by reading the first digit.
The distinction that matters most in practice is between 4xx and 5xx. A 4xx says the request was wrong and repeating it unchanged will fail again; a 5xx says the server failed and a retry may well succeed. Returning the wrong class turns a client bug into a retry storm, or hides a real outage behind what looks like user error.
How to use it
- Search by code or by meaningType 422 to see what it means, or search for "redirect" to compare the options.
- Check cacheabilitySome responses are cacheable by default — 200, 301 and 404 among them — which matters when a wrong status gets stored by a CDN and outlives the mistake.
- Follow the referenceEach entry names the RFC or extension that defines it, which settles arguments about intended semantics rather than common practice.
Frequently asked questions
What is the difference between 301 and 302?
301 is permanent: clients may cache it indefinitely and search engines transfer the old URL’s standing to the new one. 302 is temporary and should not be cached that way. Choosing 301 for something you later reverse is painful, because browsers that cached it will not ask again — which is why 307 and 308 exist as stricter versions that also preserve the request method.
When should I return 401 versus 403?
401 Unauthorized means the request lacked valid credentials — the name is a misnomer, it really means unauthenticated — and the response must include a WWW-Authenticate header. 403 Forbidden means the credentials were understood and are not sufficient. Roughly: 401 says who are you, 403 says I know who you are and no.
What is 422 and how does it differ from 400?
400 Bad Request means the request was malformed — broken JSON, a missing header. 422 Unprocessable Content means the syntax was fine but the content failed validation, such as an email address in the wrong format. The distinction is genuinely useful to a client, though plenty of APIs use 400 for both.
Should I return 404 or 410?
404 means not found, with no claim about whether it ever existed. 410 Gone says it existed and has been deliberately removed. Search engines act on 410 more decisively, dropping the URL faster. Use 410 when you know something is permanently gone and 404 for everything else.
What is a soft 404?
A page that tells the user it was not found while returning 200. Crawlers treat that as a real page with thin content, which harms indexing, and monitoring tools never notice the errors. Any not-found page must return an actual 404 status alongside its message.