If you have spent any amount of time online, you've likely seen them. Weird numbers like 200, 301 or 404. In some cases, the numbers are so common that when you see one like 404, you immediately think "File not found". So what are those numbers? They are HTTP response status codes. And it's easier to understand what they are if you understand some basics of how the web works.

At its core, the internet is a bunch of computers that store data. Whenever you click on something or open up a website, you request a resource from a server. When that server responds to your request that response includes a status code that shows the status of the request.

HTTP response status codes

HTTP response status codes seem really confusing in the beginning (because they are). But the good news is that you don't need to know them all. For the most part, if you know what 1xx, 2xx, 3xx, 4xx and 5xx refer to in general you will be okay and you can always look up details.

Informational response status codes (1xx)

HTTP response status codes that follow a 1xx pattern are informational status codes. For example, 100 is Continue and 101 is Switching Protocols. These are temporary, provisional responses and most end users never see them because browsers deal with them seamlessly.

It's rare to come across 1xx status codes unless you're implementing something or otherwise deeply immersed in systems.

Successful response status codes (2xx)

This is the happy path. 2xx means that a request was successfully received and processed by the server that received it. 200 OK is really common. It means you requested a resource correctly, the server found it and the message body contains whatever resource you requested. If you open up developer tools in your browser right now, go to the network tab or equivalent and reload this page, the status will be 200 OK (or I made a huge mistake).

201 Created is another really common status code. You see it a lot in SaaS when you create things like records or entries with a form. You click submit, your browser shows 'blah blah blah, great job entering that widget' but behind the scenes the server responded to the POST or sometimes PUT request with a 201 to show a resource has been created.

Redirection Messages (3xx)

If you're using a screen reader or following along with the headings you likely noticed something different here. We have called everything else a response but these 3xx codes are called messages. What's going on?

The best way to describe it is that 3xx indicates that a resource has moved. If the status code is 301 it means that the resource has Moved Permanently. 308 is the more modern and strict version of 301 and means Permanent Redirect. 302 is Found and means that a file has temporarily moved. 307 is the modern version of 302 and means Temporary Redirect.

Writing redirects is a big enough subject that this section really needs to become its entire resource. But I will cover some very important basics now. First and most importantly, these redirection codes mean that the client (often a browser) has to take additional steps to fulfill the request. If they're implemented properly, they'll have a location header which indicates where the browser needs to go. The tricky part with redirects is really what comes after the 3; different types of redirects will instruct clients (and especially search engines) how to treat the URL in the future. Chaining redirects can also get really tricky and it's easy to accidentally create an infinite loop of redirects.

If you ever run into caching problems, you will run into 304 which means Not Modified. 304 is the response message that you'll be glad to see when things work properly but you'll really dislike it when caching isn't working for you. If you end up here while trying to fix a caching problem, the best advice I can give you is that alcohol companies have made a number of wonderful innovations throughout the years.

Client error responses (4xx)

If HTTP response status codes were a human resources department, 4xx messages would be the equivalent of a PIP (performance improvement plan). You did something very wrong and there may or may not be clear ways for you to improve.

The biggest one here is 404 for Not Found. This one is well known enough that the term 404 has taken on a meaning even outside of software. 401 is Unauthorized or semantically it can also mean unauthenticated. 403 is Forbidden; it means that the server knows who you are but you're not allowed to access what you just tried to access.

4xx is where the language gets dark and/or very funny. 406 is Not Acceptable. 409 is Conflict. 410 is Gone. From what friends with teenagers tell me, the ten year old will soon start to resemble this part of 4xx. Or there is 418 which is I'm a teapot; meaning the server refused to brew coffee with a teapot. If you drink tea and coffee, you'll find that perfectly reasonable.

From a website integrity perspective, 404s are a real opportunity to improve. They're often a sign of broken links. You can fix broken internal links if you can find them and every 404 is an option to find. Or you can run a full website integrity tool that scans for broken links like Siteimp.

Server error responses (5xx)

If we summed 4xx up with the words 'you messed up', you could sum up all 5xx responses as 'we messed up, ahhhhhhh!!!!'. These are weird errors and can be something as simple as a service chose the most inopportune time (for a few clients) to restart all the way to developers shipped a badly borked update.

Most people have seen 500 at some point in time, usually on a white screen. Sometimes they can fix it themselves with a refresh or they try it again and it works because it was just a timing issue. Other times it's a serious problem. Hell, one of the first outside signals of the attacks on September 11, 2001 were 5xx responses reported in pagers.

A good analogy for HTTP response status codes: A library

Imagine that you go into a library and ask for a book. If:

  • the librarian pauses for a moment, that's a 1xx status.
  • the librarian hands you the book, that's a 2xx status.
  • the librarian tells you to go to another desk or another library, that's a 3xx status.
  • the librarian says they don't have the book, that's a 4xx status.
  • the librarian explodes... that's a 5xx status. (and where this analogy breaks down).

Closing words

In the case of HTTP response status codes, a little bit of knowledge and some good resources will go a long ways. This article was really just a primer on the major classes of status codes. Future resources will dig deeper into important individual classes like the 3xx and 5xx pits of pestilence and despair. Siteimp collects status codes in its full websites scans and also in its local uptime monitoring (which is a standalone product called Watch ).

When it comes to website structure and integrity, understanding the basics of HTTP response status codes will help you make sure you handle errors, migrations, full site rebuilds and outages gracefully in a way that won't confuse search engines or your users. Channeling HTTP response codes is a big step in building a reliable, usable web interface and as such, this is an important topic to cover and it's one we will dig into in many future articles.