Synonyms: HTTP response code
An HTTP status code is a three-digit number returned by a web server in response to a client’s request (usually a browser). These codes indicate whether the request was successful or if there were issues in processing it. They help users and developers understand what happened when trying to access a webpage.
HTTP status codes are divided into five main categories, each represented by the first digit of the code:
- 1xx: Informational – The request has been received and is being processed.
- 2xx: Success – The request was successfully received, understood, and accepted.
- 3xx: Redirection – Further action needs to be taken to complete the request (e.g., redirection).
- 4xx: Client Error – The request contains bad syntax or cannot be fulfilled.
- 5xx: Server Error – The server failed to fulfill a valid request.
Common HTTP Status Codes
Here are some of the most frequently encountered HTTP status codes:
1. 200 OK
- Description: The request was successful, and the server responded with the requested resource.
- When You See It: When a webpage loads correctly.
2. 301 Moved Permanently
- Description: The requested resource has been permanently moved to a new URL, and all future requests should be directed to that URL.
- When You See It: After a website changes its structure or domain, this status redirects you to the new location.
3. 404 Not Found
- Description: The server cannot find the requested resource. This usually happens when a page has been removed or the URL is mistyped.
- When You See It: When you try to visit a broken or non-existent link.
4. 403 Forbidden
- Description: The server understands the request but refuses to authorize it. You don’t have permission to access the resource.
- When You See It: When you try to access a restricted page.
5. 500 Internal Server Error
- Description: The server encountered an unexpected condition that prevented it from fulfilling the request.
- When You See It: When there’s a problem on the server side, often indicating bugs or misconfigurations.
Why Are HTTP Status Codes Important?
For developers and site administrators, HTTP status codes are critical for diagnosing issues with websites. They provide clear signals about how the server is handling requests. For example:
- 2xx codes tell you things are working fine.
- 3xx codes suggest redirection is happening.
- 4xx codes indicate that something is wrong on the client side, like a broken link or bad request.
- 5xx codes highlight server-side issues that need to be fixed to restore functionality.
Understanding these codes can help ensure that websites function smoothly and errors are addressed efficiently.