When a browser requests data from a web server, it always gets a response, which could indicate success, redirection, client-side issues, or server problems. These responses are known as HTTP status messages.
Each response is grouped into categories, such as 1xx for informational updates, 2xx for successful requests, 3xx for redirects, 4xx for client errors, and 5xx for server-side failures. Below is a breakdown of these status codes.
Category | Code | Message | Meaning |
---|---|---|---|
1xx – Information | 100 | Continue | Request headers received, send body next. |
101 | Switching Protocols | Server switching to requested protocol. | |
103 | Early Hints | Server sends hints for faster loading. | |
2xx – Success | 200 | OK | Request processed successfully. |
201 | Created | New resource successfully generated. | |
202 | Accepted | Request received but still processing. | |
204 | No Content | Request succeeded, but no content returned. | |
3xx – Redirection | 301 | Moved Permanently | Resource has a new permanent URL. |
302 | Found | Temporary relocation of the requested content. | |
304 | Not Modified | Content remains unchanged since last request. | |
4xx – Client Errors | 400 | Bad Request | Request is incorrect or malformed. |
401 | Unauthorized | Authentication required but missing. | |
403 | Forbidden | Access denied to the resource. | |
404 | Not Found | Requested content does not exist. | |
405 | Method Not Allowed | Request method is not permitted. | |
5xx – Server Errors | 500 | Internal Server Error | Server encountered an unexpected issue. |
502 | Bad Gateway | Received invalid response from another server. | |
503 | Service Unavailable | Server is overloaded or in maintenance mode. | |
504 | Gateway Timeout | Server took too long to respond. |
🔹 1xx – Informational
- 100 Continue: The server has received the request headers, and the client should proceed with sending data.
- 101 Switching Protocols: The server acknowledges a request to switch to a different communication method.
- 103 Early Hints: The server sends preliminary information to help the client prepare resources faster.
✅ 2xx – Success Responses
- 200 OK: The request was processed successfully.
- 201 Created: A new resource was successfully generated as a result of the request.
- 202 Accepted: The request has been received but hasn’t been completed yet.
- 204 No Content: The request was successful, but there’s no data to return.
- 206 Partial Content: The server is sending only a part of the requested file.
🔄 3xx – Redirections
- 301 Moved Permanently: The resource has been relocated to another URL.
- 302 Found: The requested content is temporarily available at a different location.
- 304 Not Modified: The content hasn’t changed since the last request.
- 307 Temporary Redirect: The resource has a new location but will return to the original URL later.
- 308 Permanent Redirect: Similar to 301, but ensures that the request method (GET, POST) remains unchanged.
🚫 4xx – Client Errors
- 400 Bad Request: The request is incorrect or malformed.
- 401 Unauthorized: Authentication is required but missing or incorrect.
- 403 Forbidden: The server denies access to the resource.
- 404 Not Found: The requested content isn’t available.
- 405 Method Not Allowed: The method used is not permitted for this resource.
- 408 Request Timeout: The server didn’t get a response in time.
- 410 Gone: The content has been removed permanently.
5xx – Server Errors
- 500 Internal Server Error: A generic error indicating an issue on the server.
- 502 Bad Gateway: The server received an invalid response from another server.
- 503 Service Unavailable: The server is overloaded or undergoing maintenance.
- 504 Gateway Timeout: The server took too long to get a response from another server.
- 505 HTTP Version Not Supported: The HTTP version used in the request is unsupported.
Conclusion
Understanding these codes helps developers troubleshoot website issues effectively. Handling errors properly ensures a better user experience and smoother online interactions.