Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

HTTP Status Codes Explained by Class

· 7 min read · Home Tech

In this article
  1. What Are HTTP Status Codes?
  2. The Five Classes at a Glance
  3. 1xx: Informational — Rarely Seen but Important
  4. 2xx: Success — The Codes You Want to See
  5. 3xx: Redirection — Following the Trail
  6. 4xx: Client Errors — The Problem Is on Your Side
  7. 5xx: Server Errors — The Server Is Having Trouble
  8. Common Misconceptions and How to Use This Knowledge
  9. Frequently Asked Questions

HTTP status codes are three-digit numbers a server sends back with every response to tell the client (usually a browser) whether the request succeeded, failed, or needs more action. The first digit defines the class of the response, and there are five classes: 1xx (informational), 2xx (success), 3xx (redirection), 4xx (client error), and 5xx (server error). Understanding these classes lets you diagnose web problems quickly, whether you're debugging an API, fixing a broken link, or just curious why a page won't load.

What Are HTTP Status Codes?

HTTP (Hypertext Transfer Protocol) is the foundation of data communication on the web. Every time your browser requests a page, an image, or an API call, the server replies with a status line that includes a numeric code. The code is standardized by the Internet Engineering Task Force (IETF) in RFC 9110 (formerly RFC 7231). The first digit of the code tells you the general category, and the last two digits provide more specific detail. For example, 404 means "Not Found" and 410 means "Gone" — both are 4xx client errors, but they have different meanings.

The codes are grouped into five classes, and each class has a distinct purpose. Knowing which class a code belongs to helps you know where to look for the problem: your own request, the server's configuration, or a network-level redirect.

The Five Classes at a Glance

  • 1xx – Informational: The request was received, and the server is continuing to process it. These are provisional responses and rarely seen by end users.
  • 2xx – Success: The request was received, understood, and accepted. This is the "all good" class.
  • 3xx – Redirection: The client must take additional action to complete the request, usually by following a new URL.
  • 4xx – Client Error: The request contains bad syntax or cannot be fulfilled by the server. The problem is on the client's side (e.g., a typo in the URL).
  • 5xx – Server Error: The server failed to fulfill a valid request. The problem is on the server's side (e.g., a database crash).

1xx: Informational — Rarely Seen but Important

The 1xx class is the least common in everyday browsing. These codes indicate that the server has received the request headers and is still processing. The most well-known is 100 Continue, which tells the client to send the request body. Another is 101 Switching Protocols, used when the server agrees to upgrade to a different protocol, such as WebSocket. Browsers handle these automatically, so you'll never see them in the address bar. They matter mainly for API developers and those working with low-level HTTP clients.

2xx: Success — The Codes You Want to See

When everything works, you get a 2xx code. The most common is 200 OK, which means the request succeeded and the response contains the requested data. 201 Created is used after a POST request that creates a new resource, like a new user account. 204 No Content means the request succeeded but there is no body to return — often used for DELETE operations. 206 Partial Content is used when a client requests only part of a file (e.g., for video streaming or resuming a download).

From a user's perspective, 2xx codes are invisible — the page just loads. But for developers, they confirm that an API call worked as expected.

3xx: Redirection — Following the Trail

Redirection codes tell the client that the requested resource has moved. The most common is 301 Moved Permanently, which tells search engines and browsers to update their bookmarks to the new URL. 302 Found (or 307 Temporary Redirect) indicates a temporary move — the original URL is still valid. 304 Not Modified is a special case: the server tells the client that the cached version is still fresh, so no new data is sent. This saves bandwidth and speeds up page loads.

If you see a 3xx code in your browser's developer tools, it's usually not a problem — it's the server guiding you to the correct location. However, a misconfigured redirect loop (e.g., A redirects to B, B redirects back to A) can cause errors like ERR_TOO_MANY_REDIRECTS.

4xx: Client Errors — The Problem Is on Your Side

4xx codes are the most familiar because they appear when you type a wrong URL or try to access something you shouldn't. 400 Bad Request means the server couldn't understand the request due to malformed syntax. 401 Unauthorized means you need to authenticate (log in) first. 403 Forbidden means you are authenticated but don't have permission to access the resource. 404 Not Found is the classic "page doesn't exist" error. 429 Too Many Requests indicates rate limiting — you've sent too many requests in a given time.

These codes are often caused by typos, broken links, or expired sessions. For developers, they are the first clue that a URL path or query parameter is incorrect.

5xx: Server Errors — The Server Is Having Trouble

5xx codes mean the server failed to fulfill a valid request. 500 Internal Server Error is the generic catch-all for unexpected server-side issues, such as a PHP fatal error or a database connection failure. 502 Bad Gateway means a proxy or gateway received an invalid response from an upstream server. 503 Service Unavailable indicates the server is temporarily overloaded or down for maintenance. 504 Gateway Timeout means the upstream server didn't respond in time.

These errors are not the client's fault — retrying later often works, especially for 503. For site owners, 5xx codes point to server logs, application errors, or hosting issues.

Common Misconceptions and How to Use This Knowledge

A common misconception is that 404 always means the page is gone. In reality, it can also mean the URL is mistyped, the file was moved without a redirect, or the server is intentionally hiding a resource (e.g., to prevent directory listing). Another misconception is that 401 and 403 are interchangeable — they are not: 401 means "log in first," while 403 means "you're logged in but not allowed."

When debugging, start by checking the class: if it's 4xx, inspect the request URL, headers, and authentication. If it's 5xx, check the server logs and try again after a few seconds. Browser developer tools (F12) show the status code for every request, and tools like curl -I or curl -v on the command line reveal the full response headers.

For SEO, 301 redirects are essential for preserving search rankings when a page moves, while 404s should be minimized by fixing broken internal links. A 503 with a Retry-After header is the correct way to handle planned maintenance.

Frequently Asked Questions

What does 200 OK actually mean?

200 OK means the request was successful and the server is sending the requested data in the response body. For a web page, that means the HTML content is being delivered. For an API, it means the JSON or XML response is valid. It's the most common status code and the one you want to see.

Why do I sometimes see 304 Not Modified?

304 Not Modified is a redirection response that tells your browser to use its cached copy of the resource. When you revisit a page, your browser sends a conditional request with the last-modified date or an ETag. If the server sees the file hasn't changed, it returns 304 with no body, saving bandwidth and loading time.

Is a 403 error the same as being blocked?

Not always. 403 Forbidden means the server understands your request but refuses to fulfill it. This could be due to file permissions, IP blocking, or a WAF (Web Application Firewall) rule. It's different from 401 (which asks for credentials) and from being banned entirely (which might still return 200 with a CAPTCHA page).

What should I do if I get a 500 Internal Server Error?

First, refresh the page — it might be a temporary glitch. If it persists, check the server error logs (e.g., /var/log/apache2/error.log or the hosting control panel). Common causes include a syntax error in code, a failing database connection, or a misconfigured .htaccess file. If you're not the server admin, report the error with the exact URL and time.

Can I change the status code my server returns?

Yes, if you control the server. For example, in Apache you can use ErrorDocument 404 /custom-404.html to serve a custom page. In application frameworks like Express (Node.js) or Django (Python), you can set the status code explicitly in the response object. Just make sure you use the correct code for the situation — using 200 for an error can confuse clients and SEO.