Understanding Status Codes
Every time a server responds to an HTTP request, it includes a status code — a three-digit number that summarizes what happened. These codes tell your browser (and you) whether the request succeeded, something went wrong, or additional action is needed.
Think of status codes like delivery updates for a package. "Delivered successfully," "address not found," "package delayed" — each status tells you something specific about what happened to your request.
The Five Categories
Status codes are organized into five groups based on their first digit:
1xx (Informational): The server received your request and is still processing it. These are rare in everyday browsing.
2xx (Success): Everything worked! The most common is 200 OK, meaning your request succeeded and here's the content you asked for.
3xx (Redirection): The resource moved somewhere else. 301 Moved Permanently means the page has a new URL, and your browser should update its bookmarks. 302 Found indicates a temporary redirect.
4xx (Client Error): Something was wrong with your request. The famous 404 Not Found means the resource doesn't exist at that URL. 403 Forbidden means you don't have permission to access it. 400 Bad Request indicates your request was malformed.
5xx (Server Error): The server encountered a problem. 500 Internal Server Error is a generic "something broke" message. 503 Service Unavailable often means the server is overloaded or under maintenance.
Common Codes You'll Encounter
A few status codes appear constantly:
- 200 OK — Success, here's your content
- 301/302 — This page moved, follow the redirect
- 400 Bad Request — Your request doesn't make sense
- 401 Unauthorized — You need to log in
- 403 Forbidden — You're logged in but not allowed
- 404 Not Found — This page doesn't exist
- 500 Internal Server Error — The server crashed
- 503 Service Unavailable — Try again later
Why Status Codes Matter
Understanding status codes helps you troubleshoot problems. A 404 means you have the wrong URL — check for typos. A 500 means the website has a bug — not much you can do but wait. A 403 means you might need to log in or request access.
For developers, status codes are essential for building reliable applications. Your code needs to handle different responses appropriately — displaying content for 200s, following redirects for 300s, showing error messages for 400s and 500s.