Understanding HTTP status codes is essential for web developers, system administrators, and anyone involved in web services. These codes provide insight into the server's response to a client's request, helping diagnose issues and improve user experience. Below is a detailed explanation of the complete list of HTTP status codes.
1xx: Informational
These codes indicate that the request has been received and is being processed.
- 100 Continue: The initial part of a request has been received, and the client can continue.
- 101 Switching Protocols: The server is switching protocols as requested by the client.
- 102 Processing: The server is processing the request, but no response is available yet.
- 103 Early Hints: Used to indicate that the server is likely to send a final response.
2xx: Successful
These codes indicate that the request was successfully received, understood, and accepted.
- 200 OK: The request was successful, and the server returned the requested data.
- 201 Created: A new resource has been created successfully.
- 202 Accepted: The request has been accepted for processing, but the processing is not complete.
- 203 Non-Authoritative Information: The server successfully processed the request but is returning information that may be from another source.
- 204 No Content: The server successfully processed the request but is not returning any content.
- 205 Reset Content: The server successfully processed the request, and the client should reset the document view.
- 206 Partial Content: The server is delivering only part of the resource due to a range header sent by the client.
- 207 Multi-Status: Provides status for multiple independent operations.
- 208 Already Reported: The members of a DAV binding have already been enumerated in a previous reply.
- 226 IM Used: The server has fulfilled a request for the resource and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
3xx: Redirection
These codes indicate that further action is needed to complete the request.
- 300 Multiple Choices: The request has more than one possible response.
- 301 Moved Permanently: The resource has been permanently moved to a new URL.
- 302 Found: The resource is temporarily located at a different URL.
- 303 See Other: The response to the request can be found at another URI using a GET method.
- 304 Not Modified: The resource has not been modified since the last request.
- 305 Use Proxy: The requested resource must be accessed through the proxy given by the location field.
- 306 Switch Proxy: No longer used; previously used to indicate that subsequent requests should use a different proxy.
- 307 Temporary Redirect: The resource is temporarily located at a different URL, and the client should use the original URL for future requests.
- 308 Permanent Redirect: The resource has been permanently moved to a new URL, and future requests should use the new URL.
4xx: Client Error
These codes indicate that the request contains bad syntax or cannot be fulfilled.
- 400 Bad Request: The server could not understand the request due to invalid syntax.
- 401 Unauthorized: The request requires user authentication.
- 402 Payment Required: Reserved for future use; indicates that payment is required to access the resource.
- 403 Forbidden: The server understood the request but refuses to authorize it.
- 404 Not Found: The server can't find the requested resource.
- 405 Method Not Allowed: The request method is not supported for the requested resource.
- 406 Not Acceptable: The server cannot produce a response matching the list of acceptable values defined in the request's headers.
- 407 Proxy Authentication Required: The client must first authenticate itself with the proxy.
- 408 Request Timeout: The server timed out waiting for the request.
- 409 Conflict: The request could not be completed due to a conflict with the current state of the resource.
- 410 Gone: The resource requested is no longer available and will not be available again.
- 411 Length Required: The server refuses to accept the request without a defined Content-Length.
- 412 Precondition Failed: The server does not meet one of the preconditions specified in the request.
- 413 Payload Too Large: The request is larger than the server is willing or able to process.
- 414 URI Too Long: The URI provided was too long for the server to process.
- 415 Unsupported Media Type: The request entity has a media type which the server or resource does not support.
- 416 Range Not Satisfiable: The server cannot provide the requested range.
- 417 Expectation Failed: The server cannot meet the requirements of the Expect request-header field.
- 418 I'm a Teapot: An April Fools' joke from 1998, indicating that the server is a teapot and cannot brew coffee.
- 421 Misdirected Request: The request was directed to a server that is not able to produce a response.
- 422 Un processable Entity: The request was well-formed but was unable to be followed due to semantic errors.
- 423 Locked: The resource that is being accessed is locked.
- 424 Failed Dependency: The request failed due to failure of a previous request.
- 425 Too Early: Indicates that the server is unwilling to risk processing a request that might be replayed.
- 426 Upgrade Required: The client should switch to a different protocol.
- 428 Precondition Required: The origin server requires the request to be conditional.
- 429 Too Many Requests: The user has sent too many requests in a given amount of time.
- 431 Request Header Fields Too Large: The server is unwilling to process the request because its header fields are too large.
- 451 Unavailable for Legal Reasons: The server is denying access to the resource as a consequence of a legal demand.
5xx: Server Error
These codes indicate that the server failed to fulfill a valid request.
- 500 Internal Server Error: A generic error message when the server encounters an unexpected condition.
- 501 Not Implemented: The server does not support the functionality required to fulfill the request.
- 502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from the upstream server.
- 503 Service Unavailable: The server is currently unable to handle the request due to temporary overload or maintenance.
- 504 Gateway Timeout: The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.
- 505 HTTP Version Not Supported: The server does not support the HTTP protocol version that was used in the request.
- 506 Variant Also Negotiates: The server has an internal configuration error.
- 507 Insufficient Storage: The server is unable to store the representation needed to complete the request.
- 508 Loop Detected: The server detected an infinite loop while processing a request.
- 510 Not Extended: Further extensions to the request are required for the server to fulfill it.
- 511 Network Authentication Required: The client needs to authenticate to gain network access.
Conclusion
HTTP status codes are a fundamental part of web communication, providing critical information about the state of a request. Understanding these codes can significantly enhance your ability to troubleshoot issues, improve user experience, and optimize web applications. By familiarizing yourself with this comprehensive list, you can better navigate the complexities of web development and server management.
Feel free to share your experiences or insights regarding HTTP status codes in the comments!