The must-know HTTP status codes

NicolasBrondinBernard

Author
@NicolasBrondinBernard

You surely know the codes 200, 404 and 500, but what about the others?

Article published on 26/04/2021, last updated on 10/08/2026

When you receive an HTTP response, it contains a lot of information (much of which is similar to a request), but one of its most important pieces of data is the HTTP status code.

Also called the response code or return code.

This code, associated with a status (a message in text form) and inseparable from it, gives us two very precise pieces of information:

  • What happened, or didn't happen, on the server
  • What the body of the HTTP response contains

If the code indicates success, we know that the server was able to do its job correctly and return the expected data to us.

Whereas if we receive an error code, we'll know why the request couldn't be executed correctly, and we'll be able to find more information in the body of the response.

To clearly distinguish them, HTTP codes are separated into 5 major families, each of which is represented by the first digit of the code.

Code 1xx - Information

100 - Continue

In the context of a typical request, we would rather favor codes 200 or 201 to indicate success, but sometimes the code 100 is used to say that the request has not been rejected and can continue, without indicating an actual success.

In practice, this code can for example be used when sending a very large file to the server to tell the client that the server accepts the file, without knowing whether the upload will go smoothly.

Code 2xx - Success

200 - Ok

Indicates the success of the request, the response body will then contain the requested resource or the result of the operation performed. This status is reserved for operations that are called "idempotent."

If the concept of idempotence is unfamiliar to you, I invite you to read my article dedicated to it.

201 - Created

When the operation performed has created a resource on the server (or in the database), we then use the 201 code instead of the 200 code.

Code 3xx - Redirection

Changing the address of a digital resource is much simpler than changing the address of a house, so a method is needed to easily indicate the new location of that resource.

The 3xx codes are made exactly for that, and they can themselves point to another 3xx code if the resource has moved again.

301 - Moved Permanently

The 301 redirect means that the resource has been permanently moved. Thanks to the new URL present in the "Location" header, browsers and search engines automatically redirect the user to the new destination.

In terms of SEO, a permanent redirect allows the page's organic ranking to be preserved at its old URL.

302 - Found

Equivalent to a temporary redirect.

Unlike a permanent redirect (301), a temporary redirect does not redirect organic ranking, because the operation is meant to be limited in time.

304 - Not modified

Indicates that the content of the response has not changed since the last request, and that the client can use the version of the resource present in its cache.

Code 4xx - Client error

Even when your server is working perfectly, some user requests may fail to execute fully for various reasons.

This can be due to an input error, an attempt to access private data, data that no longer exists, etc...

400 - Bad Request

This code refers to the syntax and content of the request that prevents the server from performing the desired operation.

A basic example of the use of this code is submitting an incomplete form, the missing information makes processing impossible.

401 - Unauthorized

Not authorized, or rather synonymous with "not authenticated," this code indicates that the client must provide their credentials so that the server can return the expected response.

403 - Forbidden

Indicates that a resource is inaccessible to a user even when that user is authenticated.

404 - Not Found

Undoubtedly the only HTTP code to have entered pop culture, the 404 code indicates that the resource located at the requested URI does not exist (or no longer exists).

Note that it's important to provide a specific page for this error, as explained in one of my previous articles.

409 - Conflict

This code indicates that the request conflicts with the current state of the server.

In practice, this can indicate that a resource the client is trying to create already exists on the server.

Code 5xx - Server error

When the request is correct but the server is not able to process it, the server returns a server error code.

This is the only category which, in an ideal world, should never be sent, but which in reality is essential!

500 - Internal Server Error

The 500 code indicates that the request could not be processed by the server because it encountered an unexpected situation.

This is generally the default error returned by the server when something has gone wrong without the cause being known yet.

503 - Service Unavailable

This code is returned when the server is not accessible and is not able to respond to the request, due to a bug, maintenance, or user overload.

As a bonus

418 - I'm a teapot

Originating from an April Fools' joke, the 418 status code indicates that the server refuses to serve coffee, because it is now a teapot.

Although it started as a joke, the 418 code is reserved and implemented in many web server implementations, as a way to remember that behind every computer system, there is the work of many human beings.

To fight against keeping this code, an initiative called save418 was launched and has widely won popular support!

The other codes

There are many other HTTP status codes that are interesting to discover, and for that I invite you to visit Mozilla's documentation!


Yannik Mika sur Unsplash

Finished reading this article?
Our newsletter

No spam. Only free content, news, and ever more resources to level up your skills!

Join +1500 developers

Comments (0)

to leave a comment

No comments yet