Understanding HTTP Status Codes: A Complete Guide
Every time your browser communicates with a web server, the server responds with an HTTP status code. These three-digit numbers tell your browser whether the request was successful, redirected, or encountered an error. Understanding these codes is essential for web developers, SEO professionals, and anyone who manages websites.
How HTTP Status Codes Are Organized
HTTP status codes are grouped into five classes based on their first digit. Each class represents a category of response that helps you quickly identify the nature of the server's reply.
| Class | Category | Meaning |
|---|---|---|
| 1xx | Informational | Request received, continuing process |
| 2xx | Success | Request successfully received and processed |
| 3xx | Redirection | Further action needed to complete request |
| 4xx | Client Error | Request contains bad syntax or cannot be fulfilled |
| 5xx | Server Error | Server failed to fulfill valid request |
1xx Informational Responses
These codes indicate that the server has received the request and is continuing the process. They are rarely seen in everyday browsing but are important for protocol negotiation.
- 100 Continue: The server has received the request headers and the client should proceed to send the request body.
- 101 Switching Protocols: The server is switching protocols as requested by the client via the Upgrade header.
- 103 Early Hints: Used to preload resources before the final response is ready, improving page load performance.
2xx Success Responses
These codes confirm that the request was received, understood, and processed successfully.
- 200 OK: The standard success response. The requested resource was found and returned.
- 201 Created: A new resource was successfully created, typically in response to a POST request.
- 204 No Content: The request was successful but there is no content to return. Common for DELETE requests.
- 206 Partial Content: The server is delivering only part of the resource, used for large file downloads and video streaming.
3xx Redirection Responses
Redirection codes tell the client that the requested resource is available at a different location. These are critically important for SEO because they affect how search engines index your pages.
- 301 Moved Permanently: The resource has permanently moved to a new URL. Search engines transfer link equity to the new URL. This is the most important redirect for SEO.
- 302 Found: The resource is temporarily at a different URL. Search engines typically keep the original URL indexed. Use this for temporary moves only.
- 304 Not Modified: Indicates that the cached version of the resource is still valid. This saves bandwidth by avoiding unnecessary data transfers.
- 307 Temporary Redirect: Similar to 302 but guarantees that the HTTP method will not change. More reliable than 302 for technical implementations.
- 308 Permanent Redirect: Similar to 301 but guarantees the HTTP method will not change. The modern alternative to 301 for permanent redirects.
4xx Client Error Responses
These codes indicate that the client made an error in the request. They are the most commonly encountered errors for website visitors.
- 400 Bad Request: The server cannot process the request due to malformed syntax. Check your request parameters and headers.
- 401 Unauthorized: Authentication is required and has either not been provided or has failed. The user needs to log in.
- 403 Forbidden: The server understood the request but refuses to authorize it. Unlike 401, authentication will not help.
- 404 Not Found: The requested resource does not exist on the server. This is the most common error code and has significant SEO implications if not handled properly.
- 405 Method Not Allowed: The request method (GET, POST, PUT, etc.) is not supported for the requested resource.
- 429 Too Many Requests: The user has sent too many requests in a given time period. This is rate limiting, commonly used by APIs.
5xx Server Error Responses
These codes indicate that the server failed to fulfill a valid request. They represent problems on the server side that need immediate attention.
- 500 Internal Server Error: A generic error message when the server encounters an unexpected condition. Check server logs for the root cause.
- 502 Bad Gateway: The server was acting as a gateway and received an invalid response from the upstream server. Common with reverse proxies and CDNs.
- 503 Service Unavailable: The server is temporarily unable to handle the request, usually due to maintenance or overload. Use the Retry-After header to indicate when to try again.
- 504 Gateway Timeout: The server was acting as a gateway and did not receive a timely response from the upstream server.
How to Debug HTTP Status Codes
When troubleshooting HTTP errors, follow this systematic approach:
- Check the status code: Identify whether it is a client error (4xx) or server error (5xx).
- Review server logs: For 5xx errors, server logs contain the stack trace and error details.
- Inspect request headers: Use browser developer tools to verify that your request includes correct headers, cookies, and authentication tokens.
- Test with curl: Reproduce the request using curl to isolate whether the issue is with the client or server.
- Check recent changes: Deployments, configuration updates, or DNS changes often cause status code errors.
Want to look up any HTTP status code quickly? Try our free HTTP Status Code reference tool.
Try Our HTTP Status ToolFrequently Asked Questions
What is the most common HTTP status code?
The most common HTTP status code is 200 OK, which indicates that the request was successful. Other frequently seen codes include 301 Moved Permanently, 404 Not Found, and 500 Internal Server Error.
What is the difference between 301 and 302 redirects?
A 301 redirect is permanent and tells search engines to transfer link equity to the new URL. A 302 redirect is temporary and tells search engines to keep the original URL indexed. Use 301 for permanent moves and 302 for temporary ones.
How do I fix a 403 Forbidden error?
A 403 error means the server understands the request but refuses to authorize it. Check file permissions, verify authentication credentials, ensure the user has access rights, and check for IP restrictions or security plugin blocks.
What does a 429 status code mean?
A 429 Too Many Requests status code means you have sent too many requests in a given time period. This is rate limiting. The response usually includes a Retry-After header indicating how long to wait before making another request.
Is a 500 error my fault or the server's fault?
A 500 Internal Server Error is a server-side issue, not caused by the client's request. It typically indicates a bug in the server code, a configuration error, or a resource exhaustion problem. However, if your request triggers a server bug, modifying the request may avoid the error.