DEV Community

Keyur Chaudhari
Keyur Chaudhari

Posted on

HTTP Status Codes Explained

Understanding HTTP status codes can help you troubleshoot errors, improve your website's performance, and become a more informed internet user.


  • Understanding HTTP Status Code Ranges: HTTP status codes are grouped into five ranges (1xx, 2xx, 3xx, 4xx, 5xx) to indicate the nature of the server's response to a client's request.
  • Importance of Specific Status Codes: While there are numerous status codes, remembering key codes within each range is crucial for developers to understand the outcome of their requests and handle them appropriately.
  • Practical Applications of Status Codes: Status codes inform client-side logic (like error handling and retry mechanisms), enabling developers to build more robust and user-friendly applications.

Let's break down the five main categories of HTTP status codes:


HTTP Status Codes


Cyber Writes


1xx (Informational): Indicates the server is processing the request.

  • 100 (Continue): Server received the request headers and is ready for more data.
  • 101 (Switching Protocols): Server agrees to switch protocols as requested by the client, like from HTTP to WebSockets, for a more interactive experience.

2xx (Success): Indicates the request was successfully received, understood, and accepted.

  • 200 (OK): Request was successful, and the response body contains the requested data.
  • 201 (Created): Request was successful, and a new resource was created.
  • 202 (Accepted): Request was accepted for processing, but processing is not yet complete (asynchronous tasks).
  • 204 (No Content): Request was successful, but the response body is intentionally empty (e.g. DELETE request).
  • 206 (Partial Content): The server is sending back only part of the requested resource, often used for large file downloads to break them into smaller chunks.

3xx (Redirection): Indicates further action needs to be taken to complete the request, usually involving redirecting to another URL.

  • 301 (Moved Permanently): The resource you're looking for has moved to a new location permanently. This helps search engines update their indexes.
  • 302 (Found/Temporary Redirect): Resource has temporarily moved to a new location.
  • 307 (Temporary Redirect): Similar to 302, but it preserves the original request method (like GET or POST).
  • 308 (Permanent Redirect): Similar to 301, but also preserves the request method.

4xx (Client Error): Indicates the client made an error, such as requesting a non-existent resource or providing incorrect credentials.

  • 400 (Bad Request): You sent a request that the server couldn't understand, like invalid data or incorrect syntax.
  • 401 (Unauthorized): You need to log in or provide credentials to access this resource.
  • 403 (Forbidden): Client is authenticated but does not have permission to access the requested resource.
  • 404 (Not Found): Requested resource cannot be found on the server.
  • 405 (Method Not Allowed): You're trying to use an HTTP method (like POST) that's not supported for this resource.

5xx (Server Error): Indicates the server failed to fulfill a valid request due to an internal error.

  • 500 (Internal Server Error): A general error occurred on the server.
  • 502 (Bad Gateway): The server, acting as a gateway or proxy, received an invalid response from an upstream server.
  • 503 (Service Unavailable): The server is temporarily down for maintenance or overloaded.
  • 504 (Gateway Timeout): The server, acting as a gateway or proxy, didn't receive a timely response from an upstream server.
  • 507 (Insufficient Storage): The server doesn't have enough storage space to process your request.
Retry later

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up