HTTP Status Codes: The Complete List, Explained
Contents
An HTTP status code is the three-digit number a server sends back with every response, telling the browser (or the app, or Googlebot) how the request went. 200 means it worked, 404 means the page doesn’t exist, 500 means the server broke.
The first digit tells you the category, so even a code you’ve never seen is easy to place:
| Range | Category | Meaning |
|---|---|---|
1xx |
Informational | Request received, keep going |
2xx |
Success | It worked |
3xx |
Redirection | Look somewhere else |
4xx |
Client error | The request was wrong |
5xx |
Server error | The server failed |
Below is every code you’re likely to meet, what it means, and when to use it.
How to check a status code
In the browser, open DevTools (F12), go to the Network tab and reload: the Status column shows the code for every request. From the terminal, curl -I prints only the response headers, starting with the status line.
curl -I https://markodenic.com/
# HTTP/2 200
# content-type: text/html; charset=UTF-8
# ...
# Follow redirects and show every hop
curl -IL http://markodenic.com/
1xx: Informational
You’ll rarely see these in DevTools. They’re interim responses sent before the final one.
| Code | Name | What it means |
|---|---|---|
100 |
Continue | The server got the request headers; the client can send the body. |
101 |
Switching Protocols | The server agrees to switch protocols, for example to WebSocket. |
103 |
Early Hints | Sent before the real response so the browser can start preloading CSS and fonts early, a nice web performance win. |
2xx: Success
| Code | Name | What it means |
|---|---|---|
200 |
OK | The standard success response. For a page, this is what you want. |
201 |
Created | A new resource was created, usually after a POST. Often comes with a Location header pointing to it. |
202 |
Accepted | The request was accepted but will be processed later, like a queued job. |
204 |
No Content | Success, with nothing to send back. Common for DELETE and save requests. |
206 |
Partial Content | Only part of the file was sent, because the client asked for a range. This is how video seeking and resumable downloads work. |
3xx: Redirects
A redirect tells the client to go to another URL, given in the Location header. The difference between them matters a lot for SEO.
| Code | Name | What it means |
|---|---|---|
301 |
Moved Permanently | The page has a new address for good. Search engines move the old URL’s ranking to the new one. |
302 |
Found | A temporary redirect. Search engines keep the old URL indexed. |
303 |
See Other | Go to another URL with a GET. Used after a form submission so a refresh doesn’t resubmit it. |
304 |
Not Modified | The cached copy is still fresh, so nothing is resent. A good thing: it saves bandwidth and makes pages load faster. |
307 |
Temporary Redirect | Like 302, but the method and body must stay the same (a POST stays a POST). |
308 |
Permanent Redirect | Like 301, but the method and body must stay the same. |
301 vs 302: which redirect to use
Use 301 (or 308) when the move is permanent: you changed a slug, merged two posts, or moved to HTTPS. Use 302 (or 307) only when the original URL is coming back, like a temporary maintenance page. A 302 left in place for months is one of the most common SEO mistakes. On Apache, here is how to set up 301 redirects in .htaccess.
# .htaccess (Apache)
Redirect 301 /old-post/ https://example.com/new-post/
# nginx
location = /old-post/ {
return 301 https://example.com/new-post/;
}
4xx: Client errors
Something is wrong with the request itself: a missing page, missing permissions, bad input.
| Code | Name | What it means |
|---|---|---|
400 |
Bad Request | The request is malformed: invalid JSON, a broken URL, a missing required field. |
401 |
Unauthorized | You’re not logged in, or your token is missing or expired. Despite the name, it means unauthenticated. |
403 |
Forbidden | The server knows who you are, but you’re not allowed to do this. |
404 |
Not Found | Nothing exists at this URL. |
405 |
Method Not Allowed | The URL exists but doesn’t accept this method, like a POST to a read-only endpoint. |
408 |
Request Timeout | The client took too long to send the request. |
409 |
Conflict | The request conflicts with the current state, like creating a user that already exists. |
410 |
Gone | The page existed but was removed on purpose and won’t come back. |
413 |
Content Too Large | The upload or request body is bigger than the server allows. |
415 |
Unsupported Media Type | The body is in a format the server doesn’t accept, often a missing Content-Type: application/json. |
418 |
I’m a teapot | An April Fools’ joke from 1998 that stuck around. Not for real use. |
422 |
Unprocessable Content | The request is well-formed but the data is invalid, like a form that fails validation. |
429 |
Too Many Requests | You’ve hit a rate limit. Check the Retry-After header for when to try again. |
451 |
Unavailable For Legal Reasons | Blocked for legal reasons, like a court order. The number is a nod to Fahrenheit 451. |
401 vs 403
The quick test: would logging in fix it? If yes, it’s 401 Unauthorized. If you’re already logged in and still can’t access it, it’s 403 Forbidden. APIs that return 403 for a missing token, or 401 for a permissions problem, make debugging much harder.
404 vs 410
Both tell search engines the page isn’t there, and both get it dropped from the index. 410 Gone says it was removed on purpose, so Google may drop it a little faster. In practice, use 404 by default, 410 for content you deleted deliberately, and a 301 if there’s a good replacement page.
Watch out for soft 404s: a “page not found” page that returns 200. Google Search Console flags them, and they waste crawl time. A missing page must return a real 404.
5xx: Server errors
The request was fine, but the server couldn’t handle it.
| Code | Name | What it means |
|---|---|---|
500 |
Internal Server Error | A generic crash: an exception, a PHP fatal error, a bad config. Check the server logs. |
501 |
Not Implemented | The server doesn’t support this method at all. |
502 |
Bad Gateway | A proxy or load balancer (nginx, Cloudflare) got an invalid response from the app behind it. Often the app crashed or isn’t running. |
503 |
Service Unavailable | The server is overloaded or down for maintenance. Temporary by definition. |
504 |
Gateway Timeout | The proxy waited too long for the app behind it. Usually a slow database query or an external API that hangs. |
Use 503 for maintenance
Taking a site down for maintenance? Return 503 with a Retry-After header, not a 200 “we’ll be back” page. Google treats 503 as temporary and comes back later. A 200 maintenance page can replace your real pages in the index.
// Node.js / Express
app.use((req, res) => {
res.set('Retry-After', '3600'); // seconds
res.status(503).send('Down for maintenance, back in an hour.');
});
Set a status code in your code
Most frameworks default to 200, so errors need an explicit code. If your API sends {"error": "Not found"} with a 200, clients can’t handle it properly. More fetch patterns in these JavaScript tips. To add query parameters to a request, use URLSearchParams.
// Express
res.status(404).json({ error: 'Post not found' });
// fetch: check the code before reading the body
const res = await fetch('/api/posts/42');
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const post = await res.json();
In PHP and WordPress
<?php
http_response_code(404);
// WordPress: also tell WP the query found nothing
global $wp_query;
$wp_query->set_404();
status_header(404);
FAQ
What is the most common HTTP status code?
200 OK, by far. Every page, image and script that loads successfully returns it.
What’s the difference between 301 and 308?
Both are permanent redirects. A 301 lets the client change a POST into a GET when following it; a 308 keeps the method and body. For normal page redirects they behave the same.
Is a 304 status code an error?
No. 304 Not Modified means the browser’s cached copy is still valid, so the server didn’t send the file again. It makes pages load faster.
What causes a 502 Bad Gateway?
The proxy in front of your app (nginx, a load balancer, Cloudflare) couldn’t get a valid response from it. Usually the app process crashed, is restarting, or is listening on a different port than the proxy expects.
Do status codes affect SEO?
Yes, they’re a core part of technical SEO. Google only indexes pages that return 200, follows 301s to pass rankings to the new URL, drops 404 and 410 pages, and slows down crawling when it sees many 5xx errors.
Related: how to optimize your website for SEO, web performance and JavaScript tips.