Everything You Need to Know About HTTP Response Status Codes

Read Time:4 Minute, 26 Second

HTTP response codes are often ignored, but they are a really important mechanism to standardize responses from remote servers. When a program (or user) issues a request to a server, there are a few things that could happen, as follows:

  • It could fail validation

  • It could be successful

  • It could produce a server error

As you can see, the possibilities are endless. The problem that we now have is that HTTP was created for the communication between machines. How do we handle the fact that machines will be reading these codes?

HTTP solved this problem in a very elegant way: every single request has to be resolved with an HTTP code and these codes have ranges that indicate the nature of the code.

This post introduces several server status and error codes, and explains what they reveal about what’s happening on the server behind the scenes.

Let’s dive in!

1xx — Informational Codes

The codes in the 100–199 range are purely informational. The most interesting code in this range is the 102 code. This code is used to specify that an operation is happening in the background and might take some time to complete.

2xx — Success codes

Success codes are used to indicate a certain level of success in the HTTP request. It is the most common (and desired) codes.

The most common codes in this range are as follows:

  • 200: Success: This code indicates full success. Nothing went wrong even remotely.

  • 201: Created: This code is used mainly for REST APIs when the client requests to create a new entity in the server.

  • 203: Non-authoritative information: This code is intended to be used when, while routing the request through a transforming proxy, the origin responds with a 200.

  • 204: No Content: This is a successful code, but there is no content coming back from the server. Sometimes, APIs return 200, even if there is no content.

  • 206: Partial Content: This code is used for paginated responses. A header is sent, specifying a range (and an offset) that the client will accept. If the response is bigger than the range, the server will reply with 206, indicating that there is more data to follow.

3xx — Redirection Codes

The codes in the 300 to 399 range indicate that the client must take some additional actions to complete the request.

The most common codes in this range are described as follows:

  • 301: Moved permanently: This status code is indicating that the resource that the client was trying to get has been moved permanently to another location.

  • 302: Found: This code indicates that the user is required to perform a temporary redirect for some reason, but the browsers started implementing this code as 303 See Other. This lead to the introduction of the 303 and 307 Temporary redirect codes to disambiguate the overlap of behavior.

  • 308 Permanent Redirect: This code, as the name indicates, is used to specify a permanent redirect for a resource. It could be confused with 301, but there is a small difference, the 308 code does not allow the HTTP method to change.

4xx — Client errors

The codes in the 400 to 499 range represent errors generated by the client. They indicate that there is a problem with the request. This range is particularly important as it is the way that HTTP servers have to indicate the clients that something is wrong with their request.

The common codes in this range are as follows:

  • 400 bad Request: This code indicates that the request from the user is syntactically incorrect. There could be parameters missing or some of the values didn’t pass validation.

  • 401 Unauthorized: This code represents a lack of authentication of the client. Usually, a valid login will fix this problem.

  • 403 Forbidden: This is similar to 401, but in this case, it is indicating that the user does not have enough privileges.

  • 404 Not Found: This means that the resource is not found in the server. This is the error that you get when you navigate to a page that does not exist.

5xx — Server errors

This range indicates that there has been a processing error in the server. When a 5xx code is issued, it means that there was some sort of problem in the server and it cannot be fixed from the client.

Some of the codes in this range are as follows:

  • 500 Internal Server Error: This means that an error has occurred in the software on the server. There is no more information disclosed.

  • 501 Not Implemented: This error status code indicates that the server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.

  • 503 service unavailable: This code is issued when the server is not available for some reason, either an excess of the load or the server is down.


While they may seem confusing or intimidating on the surface, HTTP status codes are actually very informative. By learning some of the common ones, you can troubleshoot problems on your site more quickly. You can find the complete list of HTTP response codes here.

Source: https://dev.to/devland/everything-you-need-to-know-about-http-response-status-codes-2mfb