HTTP Status Codes Explained: The Ones You Actually Need
Developer · Published October 4, 2026 · Updated October 24, 2026 · 4 min read
Written by Akinrinmade Michael
Every web response starts with a three-digit status code. The first digit gives the family and the other two say what happened. There are dozens of codes, but you'll meet the same dozen or so most of the time. Knowing them turns a vague "the site is broken" into a specific question you can act on.
The five families
- 1xx: informational, the request is still being worked on.
- 2xx: success.
- 3xx: redirection, the client needs to go somewhere else.
- 4xx: the client made a mistake.
- 5xx: the server made a mistake.
That split is the first thing to check when something fails. A 4xx means the fix is probably in the request: the address, the login or the data you sent. A 5xx means the request was fine and the problem is on the server side, so retrying later or telling the site owner is the useful move.
Success
- 200 OK: it worked, and here's the result.
- 201 Created: a new resource was created, usually after a POST. A
Locationheader often points to it. - 202 Accepted: the request was received and will be handled later, as with a background job.
- 204 No Content: it worked, and there's nothing to send back. Common for DELETE.
Redirects
| Code | Meaning | Method kept? | Search engines |
|---|---|---|---|
| 301 | Moved permanently | May change POST to GET | Pass ranking to the new address |
| 302 | Found, temporary | May change POST to GET | Keep the old address |
| 303 | See other | Always switches to GET | Keep the old address |
| 307 | Temporary redirect | Method kept | Keep the old address |
| 308 | Permanent redirect | Method kept | Pass ranking to the new address |
For ordinary page moves, 301 is the one you want. Use 307 or 308 when the request is a form submission or an API call and the method has to stay the same. And 304 Not Modified isn't a redirect at all: it tells the browser its cached copy is still good, which saves a download.
Client errors
- 400 Bad Request: the request is malformed, such as broken JSON.
- 401 Unauthorized: you aren't logged in, or your credentials are wrong.
- 403 Forbidden: the server knows who you are, but you aren't allowed to do this.
- 404 Not Found: nothing exists at this address.
- 405 Method Not Allowed: the address exists, but not for this method, like a POST to a page that only reads.
- 409 Conflict: the request clashes with the current state, such as creating something that already exists.
- 410 Gone: the page was removed on purpose and won't come back.
- 413 Content Too Large: the upload is bigger than the server accepts.
- 422 Unprocessable Content: the request is well formed, but the data fails validation.
- 429 Too Many Requests: you've hit a rate limit. Wait and retry.
Server errors
- 500 Internal Server Error: something unexpected broke on the server.
- 501 Not Implemented: the server doesn't support what was asked.
- 502 Bad Gateway: a proxy got a bad answer from the server behind it.
- 503 Service Unavailable: the server is overloaded or down for maintenance. A
Retry-Afterheader can say when to try again. - 504 Gateway Timeout: a proxy waited too long for the server behind it.
401 or 403?
Use 401 when the visitor hasn't proven who they are, and 403 when they have, but aren't permitted. Showing a login page after a 401 makes sense. Showing one after a 403 doesn't, because logging in again won't help.
404 or 410?
A 404 says "I can't find that", and a crawler will come back and check again for a while. A 410 says "this was removed deliberately", and search engines tend to drop the page sooner. If you retire a page and have no replacement, 410 is the clearer signal. If there's a replacement, redirect with a 301 instead.
Soft 404s
A soft 404 is a page that says "not found" to a person but returns 200 OK to a crawler. Search engines treat those as errors and may ignore the page. If your site shows a friendly not-found message, make sure the response code is a real 404 too.
Picking codes for your API
Return the most specific code that's true. Use 201 after creating something, 204 after a delete, 422 for validation problems and 429 for rate limits. Always send a short error message in the body as well, so developers can see what to fix, and keep the format the same for every error so clients only need one way to read them.
| Situation | Code |
|---|---|
| Created a user | 201 |
| Updated a user and returning nothing | 204 |
| Missing or expired login token | 401 |
| Logged in, but not an admin | 403 |
| User id doesn't exist | 404 |
| Email already registered | 409 |
| Email field isn't a valid email | 422 |
| Caller sent 100 requests in a minute | 429 |
Look up any code in the HTTP Status Codes list, which you can search by number or by word. If a 401 comes with a token, the JWT decoder shows whether it has expired, and the URL parser helps spot a typo in the address behind a 404.