# HTTP status codes

> The three-digit number a web server sends back to say how your request went.

- Level: Basic
- Topics: Networks
- URL: https://tidbit.legios.com.ar/http-status-codes/
- In Spanish: [Códigos de estado HTTP](https://tidbit.legios.com.ar/es/http-status-codes/)

Every time your browser or an app asks a server for something over HTTP, the answer starts with an **HTTP status code**: a three-digit number that sums up what happened. Most of the time you never see it, because it is `200 OK` and the page simply loads. You notice it when something goes wrong, like the famous `404 Not Found`.

The first digit tells you the family. `2xx` means success. `3xx` means the thing moved and the browser should go look elsewhere, like `301 Moved Permanently`. `4xx` means the problem is on the client's side: a wrong URL (`404`), a missing login (`401`), no permission (`403`), too many requests in a row (`429`). `5xx` means the server failed: `500 Internal Server Error` is a bug or crash, and `503 Service Unavailable` usually means it is overloaded or down for maintenance.

For developers these numbers are a shared language. Monitoring tools count how many `5xx` a site returns to detect outages, search engines read `301` to know a page moved, and an API uses them to tell a program exactly why its request was rejected.

## An analogy

Like the short answers at a pharmacy counter: here you go (200), we moved it to the other branch (301), that prescription does not exist (404), you need to show ID (401), sorry, our system is down (500).

## Keep in mind

- 2xx success, 3xx redirect, 4xx client error, 5xx server error.
- 404 means the address points to nothing; it is not a server crash.
- 500 and 503 mean the problem is on the website's side, not yours.
- APIs use status codes so programs know why a request failed.

## Go deeper

- [HTTP response status codes (MDN)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status)
- [List of HTTP status codes on Wikipedia](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
- [RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html)

## Related terms

- [Web browser](https://tidbit.legios.com.ar/web-browser/): The app that fetches web pages from the internet and draws them on your screen.
- [Server](https://tidbit.legios.com.ar/server/): A computer whose job is to answer requests from other computers, all day, every day.
- [HTTP](https://tidbit.legios.com.ar/http/): The request-and-response language browsers and websites speak.
- [URL](https://tidbit.legios.com.ar/url/): The full address of something on the web: protocol, site and path.
- [Bug](https://tidbit.legios.com.ar/bug/): A mistake in software that makes it behave differently from what was intended.
- [API](https://tidbit.legios.com.ar/api/): The menu of things one program lets another program ask for.
- [Website](https://tidbit.legios.com.ar/website/): A set of web pages under one address, stored on a server and opened in a browser.
