What HTTP status codes mean: the five classes, 200, 301, 401 vs 403, 404 and 500, why soft 404s mislead, and how to check a code in DevTools or with curl.
HTTP status codes, explained by cats. Kitty runs a tuna shop website. Her server answers every page with a number. Three digits. That's the status code. The first digit says how it went. Starts with a 2? It worked. A 3?
Look somewhere else. A 4? The customer's mistake. A 5? Kitty's mistake. A cat opens the menu. 200. OK. The menu moves to a new page. 301. Moved for good. A cat opens her order history. Not logged in. 401.
'Who are you?' A logged-in cat tries the admin page. 403. 'I know you. Still no.' A cat types /salmon. 404. No such page. Then Kitty's code crashes. 500. Something broke inside. But servers can lie. Some send 200. With an error page inside.
Kitty's rule: the number matches the page. No tuna found? 404. Not 200. She checks with curl -I. Those are the most common status codes. There are dozens more. 451. Blocked for legal reasons. And 418. 'I'm a teapot.' Three little digits. So every cat knows if the tuna is coming.
HTTP status codes are the three-digit numbers a server sends before anything else when it answers a request. They tell the browser, and any program or search engine reading the response, whether the request worked and, if it didn't, whose fault it was.
What the three digits mean
The first digit puts the code in one of five classes. The other two pick a specific answer within that class.
First digit
Class
What it says
1xx
Informational
Hold on, more is coming
2xx
Success
It worked
3xx
Redirection
Look somewhere else
4xx
Client error
The request was wrong
5xx
Server error
The server failed
You'll rarely see a 1xx code. They are interim messages sent before the real answer, and browsers deal with them quietly.
The class matters more than the exact number. HTTP's specification, RFC 9110, says a client that meets a code it doesn't recognise must treat it as the x00 code of its class. A browser that has never heard of 299 handles it as a 200, and an unknown 4xx is read as a plain 400. So even an odd code tells the client roughly what happened.
The split between 4 and 5 is the useful one when something goes wrong. A 4xx means the client should change the request, by logging in or fixing the address, say. Sending the same request again won't help. A 5xx means the request may have been fine and the server fell over, so trying again later can succeed.
HTTP status codes, explained by cats. Kitty runs a tuna shop website. Her server answers every page with a number. Three digits. That's the status code. The first digit says how it went. Starts with a 2? It worked. A 3?
Look somewhere else. A 4? The customer's mistake. A 5? Kitty's mistake. A cat opens the menu. 200. OK. The menu moves to a new page. 301. Moved for good. A cat opens her order history. Not logged in. 401.
'Who are you?' A logged-in cat tries the admin page. 403. 'I know you. Still no.' A cat types /salmon. 404. No such page. Then Kitty's code crashes. 500. Something broke inside. But servers can lie. Some send 200. With an error page inside.
Kitty's rule: the number matches the page. No tuna found? 404. Not 200. She checks with curl -I. Those are the most common status codes. There are dozens more. 451. Blocked for legal reasons. And 418. 'I'm a teapot.' Three little digits. So every cat knows if the tuna is coming.
The request worked and the response body is what was asked for, whether that's a page or an API's JSON. Most of the requests in a browser's Network tab are 200s. Its siblings show up in APIs: 201 Created after something new is made, and 204 No Content when the action worked and there is nothing to send back.
301 Moved Permanently
The page has a new address for good. The response includes that address, and the browser follows it on its own, so a visitor who types the old URL lands on the new one. In the Network tab that shows as two rows: the 301 for the old address, then a 200 for the new one.
'Permanently' matters. Browsers may cache a 301 and skip the old address next time, and search engines move the old page's place in their results to the new one. That makes 301 the right code when you rename a page or move a site to a new domain, and the wrong one for anything temporary. For a short-term move, such as sending visitors to a maintenance page, use 302 Found or 307 Temporary Redirect. 308 Permanent Redirect is the strict version of 301: it keeps the request's method, so a form submission stays a form submission after the redirect.
401 Unauthorized and 403 Forbidden
These two are easy to mix up. The difference is whether the server knows who you are.
401 means the server doesn't know who you are. You aren't logged in, or your login has expired. The name is misleading: it's about authentication (proving who you are), not permission. Logging in can fix it.
403 means the server knows exactly who you are, and the answer is still no. A logged-in customer opening the admin area gets a 403. Logging in again won't change anything, because the account doesn't have the right.
A shop's order history is the classic 401: it only makes sense once you've signed in. Its admin pages are the classic 403. Some servers return a 404 instead of a 403 so they don't reveal that a private page exists at all, and the specification allows that.
404 Not Found
There is nothing at this address. The user mistyped it, followed an old link, or the page was removed. A 404 says nothing about whether the page will ever exist. When you know a page has gone for good, 410 Gone says so explicitly.
500 Internal Server Error
The server's own code failed while handling the request, often with an unhandled exception such as a database query that blew up. The 500 is a catch-all. It tells the client something broke, and the details belong in the server's logs, not in the response, where a stack trace could tell an attacker how the site is built.
Three other 5xx codes point at different parts of a setup, which helps when you're tracking down an outage:
502 Bad Gateway: a proxy or load balancer in front of your app got a broken answer, or none, from the app behind it.
503 Service Unavailable: the server is overloaded or down for maintenance, and should be back.
504 Gateway Timeout: the proxy gave up waiting for the app to reply.
When the number lies: soft 404s
The status code and the page are separate things. A server can send a page that says 'Not found' with a 200 status, and nothing in HTTP stops it. This is called a soft 404. It usually happens when a framework catches every missing route, renders a friendly error page and forgets to set the status.
Here is an expired deal page on a small shop's site. The page says the deal is gone, while the Network tab below it shows the server answered 200:
A human reading that page understands it. Everything else believes the 200:
Search engines see a working page and may index it. Google spots many soft 404s, keeps them out of its results and lists them in Search Console as errors to fix.
Monitoring that checks status codes reports the site as healthy while visitors hit dead pages.
Caches can store the error page as if it were the real content.
Programs calling an API try to read the error page as data, and fail in a confusing place far from the real problem.
The fix is to make the number match the page: when the deal no longer exists, send a 404 and keep the friendly page as its body. A 404 can carry the same helpful page with links back to the shop; the status code only changes what machines conclude.
Checking a status code yourself
You don't need any special tools. Two ways cover almost everything:
The browser's DevTools. Open them (F12 in most browsers), go to the Network tab and reload. Every request gets a row, and the Status column shows its code. Redirects show up as separate rows, so a 301 followed by a 200 is easy to spot.
curl in a terminal. Running curl -I with an address prints the server's response without the page. The first line is the status line: the HTTP version, the code and a short reason phrase.
After the fix, the expired deal page answers like this:
Two details can trip you up. curl -I sends a HEAD request, which asks for the response without its body, and a badly written server can answer HEAD differently from a normal GET, so check in the browser too if the two disagree. And the reason phrase ('Not Found') is only a label for humans: clients act on the number. Over HTTP/2 the phrase disappears completely and curl shows just HTTP/2 404.
Common mistakes
Sending 200 for errors. The soft 404 above, and its API cousin: a 200 whose body says "error": "not found". If something failed, the code should say so. The REST API Best Practices page covers choosing codes for an API.
Using 401 when you mean 403. If the user is logged in and lacks permission, that's a 403. A 401 tells them to log in, which they already did.
Making temporary redirects permanent. A 301 can stick in browsers' caches long after you change your mind. Use 302 or 307 until you're sure.
Returning 500 for bad input. If the client sent invalid data, that's a 4xx, usually 400 Bad Request. A 500 says your code is broken, and it sends you looking in the wrong place.
Leaking details in a 500. Show the user a short apology and log the stack trace on the server.
The odd ones
The registry of codes, kept by IANA, lists dozens beyond the common few. Two are known for their stories.
451 Unavailable For Legal Reasons
This is a real code, defined in 2016 for content that can't be shown because of a legal demand, such as a court order. The number is a nod to Ray Bradbury's novel Fahrenheit 451, about burning books.
418 I'm a teapot
This one started as a joke. It comes from RFC 2324, an April Fools' specification from 1998 for controlling coffee pots over the web, where a teapot asked to brew coffee replies 418. It was never part of HTTP, but enough software implemented it that RFC 9110 now reserves the number so nobody gives it a serious meaning.
Key takeaways
Every HTTP response carries a three-digit status code, and its first digit gives the class: 2xx worked, 3xx look elsewhere, 4xx client error, 5xx server error.
401 means 'who are you?' and 403 means 'I know you, and no'.
A 301 is a permanent move that browsers and search engines remember; use 302 or 307 for temporary ones.
The code must match the page: a 'not found' page sent with 200 is a soft 404 that misleads search engines, monitoring and API clients.
Check any code in the DevTools Network tab or with curl -I.