HTTP Status Codes: Everything You Need to Know

CodingTute

Updated on:

HTTPS

If you’re a website owner or a developer, you must have come across HTTP status codes. These codes indicate the status of a website’s server when you access it. They help understand whether a website’s server is functioning correctly or not. In this article, we’ll cover everything you need to know about HTTP status codes.

Also Read: HTTP Methods

What is an HTTP Status Code?

An HTTP status code is a three-digit number that comes as a response to an HTTP request. It indicates the status of the requested resource. In simpler terms, when you request a web page, the server sends back a code that lets you know if the server is okay and if the page you’ve requested exists.

Types of HTTP Status Codes

There are five classes of HTTP status codes:

  • 1xx: Informational – Request received, continuing process
  • 2xx: Success – The action was successfully received, understood, and accepted
  • 3xx: Redirection – Further action must be taken in order to complete the request
  • 4xx: Client Error – The request contains bad syntax or cannot be fulfilled
  • 5xx: Server Error – The server failed to fulfill an apparently valid request

Informational responses (100–199)

These are used to acknowledge and inform that the server has received the request. An example of this status code is 100, which means the request was received, and the server is continuing the process.

Status CodeDescription
100Continue
101Switching Protocols
102Processing
103Early Hints
104 – 199Unassigned
HTTP Status Codes: Informational Responses
  • 100 Continue: The server has received the initial part of the request and is continuing to process the request.
  • 101 Switching Protocols: The server has received a request to switch protocols and is acknowledging this with the client.
  • 102 Processing: The server has received and is processing the request, but no response is available yet.
  • 103 Early Hints: The server is sending some response headers before the final response, to give the client some information that can be used to optimize the request.

Successful responses (200–299)

These indicate that the server has successfully received, understood, and processed the request. An example of this status code is 200, which means the request was successful and resulted in a response.

Status CodeDescription
200OK
201Created
202Accepted
203Non-Authoritative Information
204No Content
205Reset Content
206Partial Content
207Multi-Status
208Already Reported
209 – 225Unassigned
226IM Used
HTTP Status Codes: Successful Responses
  • 200 OK: The request has been successful, and the response body contains the requested information.
  • 201 Created: The request has been successful, and a new resource has been created as a result.
  • 202 Accepted: The request has been accepted for processing, but the processing has not been completed yet.
  • 203 Non-Authoritative Information: The server is a proxy, and the response is coming from a different source, but is still considered valid.
  • 204 No Content: The request has been successful, but there is no response body to return.
  • 205 Reset Content: The request has been successful, and the client should reset its view of the resource.
  • 206 Partial Content: The server is sending only part of the resource requested by the client.
  • 207 Multi-Status: The response is a collection of separate responses, one for each resource in the request.
  • 208 Already Reported: The members of a WebDAV binding have already been enumerated in a previous reply to this request, and are not being included again.
  • 226 IM Used: The response is a representation of the result of one or more instance manipulations applied to the current instance.

Redirection messages (300–399)

These indicate that further action is required to complete the request. They are used for redirecting users to different URLs or locations. An example of this status code is 302, which means the resource has temporarily moved to a different URL.

Status CodeDescription
300Multiple Choices
301Moved Permanently
302Found
303See Other
304Not Modified
305Use Proxy
306Switch Proxy (Deprecated)
307Temporary Redirect
308Permanent Redirect
309 – 399Unassigned
HTTP Status Codes: Redirection Messages
  • 300 Multiple Choices: The request has multiple possible responses, and the server is returning a list of options for the client to choose from.
  • 301 Moved Permanently: The requested resource has been permanently moved to a new URL, and the client should update its bookmarks and links accordingly.
  • 302 Found: The requested resource has been temporarily moved to a new URL, and the client should continue to use the original URL for future requests.
  • 303 See Other: The response to the request can be found under a different URL, and the client should make a new request using the new URL.
  • 304 Not Modified: The requested resource has not been modified since the client’s last request, and the server is returning the cached copy.
  • 305 Use Proxy: The requested resource can only be accessed through a proxy, and the client should use the proxy to access the resource.
  • 306 Switch Proxy (Deprecated): This status code is no longer used.
  • 307 Temporary Redirect: The requested resource has been temporarily moved to a new URL, and the client should continue to use the original URL for future requests.
  • 308 Permanent Redirect: The requested resource has been permanently moved to a new URL, and the client should update its bookmarks and links accordingly.

Client error responses (400–499)

These indicate that the server received a malformed or invalid request from the client. An example of this status code is 404, which means the requested resource was not found on the server.

Status CodeDescription
400Bad Request
401Unauthorized
402Payment Required
403Forbidden
404Not Found
405Method Not Allowed
406Not Acceptable
407Proxy Authentication Required
408Request Timeout
409Conflict
410Gone
411Length Required
412Precondition Failed
413Payload Too Large
414URI Too Long
415Unsupported Media Type
416Range Not Satisfiable
417Expectation Failed
418I’m a teapot
421Misdirected Request
422Unprocessable Entity
423Locked
424Failed Dependency
426Upgrade Required
428Precondition Required
429Too Many Requests
430Unassigned
431Request Header Fields Too Large
432 – 450Unassigned
451Unavailable For Legal Reasons
452 – 499Unassigned
HTTP Status Codes: Client Error Responses
  • 400 Bad Request: The server was unable to understand the request due to invalid syntax.
  • 401 Unauthorized: The request requires authentication, and the client has not provided valid credentials.
  • 402 Payment Required: This status code is reserved for future use.
  • 403 Forbidden: The client does not have permission to access the requested resource.
  • 404 Not Found: The requested resource could not be found on the server.
  • 405 Method Not Allowed: The requested method is not supported for the requested resource.
  • 406 Not Acceptable: The requested resource is not capable of generating a response that meets the requirements specified in the request’s headers.
  • 407 Proxy Authentication Required: The client must first authenticate itself with the proxy before making this request.
  • 408 Request Timeout: The server timed out waiting for the request from the client.
  • 409 Conflict: The request could not be completed due to a conflict with the current state of the resource.
  • 410 Gone: The requested resource is no longer available on the server and there is no forwarding address.
  • 411 Length Required: The server requires a Content-Length header to be included in the request.
  • 412 Precondition Failed: The precondition given in the request header fields did not match the server’s preconditions.
  • 413 Payload Too Large: The request is larger than the server is willing or able to process.
  • 414 URI Too Long: The URI provided in the request is too long for the server to process.
  • 415 Unsupported Media Type: The server does not support the media type specified in the request’s headers.
  • 416 Range Not Satisfiable: The requested range cannot be returned by the server.
  • 417 Expectation Failed: The expectation given in the request’s Expect header could not be met by the server.
  • 418 I’m a teapot: This status code is a joke and not intended to be used in serious applications.
  • 421 Misdirected Request: The request was directed at a server that is not able to produce a response.
  • 422 Unprocessable Entity: The server understands the request, but is unable to process it due to semantic errors.
  • 423 Locked: The requested resource is locked and the client should try again later.
  • 424 Failed Dependency: The requested resource depends on another resource, and that resource failed to complete the request.
  • 426 Upgrade Required: The client should switch to a different protocol, such as TLS/1.3.
  • 428 Precondition Required: The server requires the request to be conditional, and the client did not provide the necessary precondition headers.
  • 429 Too Many Requests: The user has sent too many requests in a given amount of time (“rate limiting”).
  • 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 requested resource is unavailable due to legal reasons, such as censorship or government-mandated blocked access.

Server error responses (500–599)

These indicate that there was an error on the server while processing the request. An example of this status code is 500, which means there was an internal server error, and the request could not be completed.

Status CodeDescription
500Internal Server Error
501Not Implemented
502Bad Gateway
503Service Unavailable
504Gateway Timeout
505HTTP Version Not Supported
506Variant Also Negotiates
507Insufficient Storage
508Loop Detected
509Unassigned
510Not Extended
511Network Authentication Required
512 – 599Unassigned
HTTP Status Codes: Server Error Responses
  • 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request.
  • 501 Not Implemented: The server does not support the functionality required to fulfil the request.
  • 502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from an upstream server.
  • 503 Service Unavailable: The server is currently unable to handle the request due to temporary overload or maintenance of the server.
  • 504 Gateway Timeout: The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server.
  • 505 HTTP Version Not Supported: The server does not support the HTTP protocol version used in the request.
  • 506 Variant Also Negotiates: Transparent content negotiation for the request results in a circular reference.
  • 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 the 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.

HTTP Status Codes Cheat Sheet

Download HTTP Status Codes Cheat Sheet

Importance of HTTP Status Codes

HTTP status codes have a significant impact on a website’s user experience. If a user comes across an error code, it can be frustrating and can also cause them to leave the website. It can also impact a website’s search engine optimization (SEO) and can result in a lower search engine ranking.

For website owners, understanding different HTTP status codes can help them identify and resolve issues on their website. For example, if a website owner sees a 404 status code, they can quickly identify which pages are missing and fix them.

Conclusion

In conclusion, HTTP status codes play a critical role in the functioning and user experience of a website. Proper understanding of different status codes can help website owners and developers identify and fix issues on their website. Therefore, it’s essential to pay attention to these codes and address any issues that may arise to ensure a seamless user experience.

Checkout the HTTPS category for more related content HTTP/HTTPS.

Follow us on Facebook, YouTube, Instagram, and Twitter for more exciting content and the latest updates.

Exit mobile version