HTTP Status Codes

HTTP status codes are numerical responses from a web server that indicate the status of a request made to the server. These codes are part of the HTTP (Hypertext Transfer Protocol), which is the foundation of data communication on the World Wide Web. HTTP status codes are divided into five categories, each defined by the first digit of the code, representing the response's nature:

  1. 100 - 199 (Informational): These codes indicate a provisional response and are used to communicate transfer protocol-level information. They signify that the request has been received and the process is continuing.

  2. 200 - 299 (Successful): This category signifies that the request was successfully received, understood, and accepted. Common codes include 200 (OK), which indicates that the request has succeeded, and 201 (Created), indicating that a resource has been created in response to the request.

  3. 300 - 399 (Redirection): These codes indicate that further action needs to be taken by the requester to complete the request. This usually involves a redirection to another URI (Uniform Resource Identifier). For example, 301 (Moved Permanently) is used when a resource has been moved to a new URL, and 304 (Not Modified) indicates that the cached version of the requested resource is still valid.

  4. 400 - 499 (Client Error): This category represents errors on the client's part, suggesting that the request contains bad syntax or cannot be fulfilled. A well-known example is 404 (Not Found), which indicates that the server cannot find the requested resource. Another example is 401 (Unauthorized), which means that authentication is required and has failed or has not yet been provided.

  5. 500 - 599 (Server Error): These codes indicate that the server failed to fulfill an apparently valid request, implying an error on the server's part. For example, 500 (Internal Server Error) suggests a generic server error when the server encounters an unexpected condition, and 503 (Service Unavailable) indicates that the server is not ready to handle the request, often due to maintenance or overload.

Each HTTP status code provides valuable information for the developer or the end user, indicating what happened to the request and what actions, if any, can be taken in response. They are an essential part of web development and internet communication, facilitating troubleshooting, debugging, and the smooth operation of web applications.

100 - 199 (Informational)

100 Continue

Is a signal between a web client and server. It indicates that the initial part of a request has been received by the server and looks good so far. The client can then safely send the rest of the request, typically a large data payload. This code is optional and not used in all transmissions.

101 Switching Protocols

Indicates that the server agrees to switch to a different communication protocol from the one initially requested by the client. This happens when the client sends an "Upgrade" header in its request, proposing a new protocol. The server responds with 101 and an "Upgrade" header of its own, specifying the new protocol it's switching to.

103 Early Hints

Is an informational code called "Early Hints". It's sent by a server to a browser while the server is still working on the main response. This code provides hints to the browser about resources it might need, like images or stylesheets. With these hints, the browser can start preparing to download those resources before it gets the full response from the server, potentially speeding up page load times.

200 - 299 (Successful)

200 OK

The HTTP status code 200, also written as "200 OK", indicates that everything went well with the request. The server successfully fulfilled the client's request and transmitted the requested data. You'll typically see this code in the background when using a web browser, but some developer tools can display it to you.

201 Created

Indicates that a client's request was successful and resulted in the creation of a new resource on the server. This code is typically used following a POST request, which is often used to submit data for creating new resources.

202 Accepted

The HTTP status code 202, "Accepted," means the server has received your request and understood it. However, the processing of the request hasn't finished yet. This code is typically used for requests that take a long time to complete, such as uploading a large file or running a complex background task. In simpler terms, it's like saying "I got your request and I'm working on it, but it might take a while."

203 Non-Authoritative Information

The HTTP status code 203 indicates that the information you requested was successfully retrieved, but there's a twist: the data itself came from a cache or a proxy server, not the original source. This means the information might not be the absolute latest version.

204 No Content

The HTTP status code 204, "No Content," indicates that a request was successful, but there is no additional information to send back to the client. In simpler terms, the server processed your request and everything went well, but there's nothing new to show you. This is commonly used after DELETE requests (e.g., deleting a file) or after successful updates where the content remains the same.

205 Reset Content

The HTTP status code 205 is known as "Reset Content". It indicates that the server has successfully processed your request and wants the client (usually a web browser) to reset the current document view.

206 Partial Content

The HTTP status code 206, "Partial Content", means the server successfully fulfilled a request for part of a resource. This typically happens when the client (like your web browser) instructs the server to only send a specific portion of a file, using a feature called "byte ranges". This is useful for things like:

  • Resuming downloads that were interrupted
  • Streaming media, where you only need a chunk of the video at a time

The server will respond with the requested data and a status code of 206, indicating it's just a piece of the whole thing.

300 - 399 (Redirection)

300 Multiple Choices

The HTTP status code 300 stands for "Multiple Choices." It indicates that the server has multiple possible responses for the requested resource. In theory, the user agent (like a web browser) or the user themself should choose which response they want. However, there's no standard way to choose between the options, so this code is rarely used. In most cases, you'll see a different redirect code like 301 (Moved Permanently) or 302 (Found) which tell the user agent exactly where to go.

301 Moved Permanently

This code is used to indicate that a web page or resource has been permanently moved to a new location. When a browser encounters a 301 redirect, it will automatically forward you to the new URL. Search engines are also notified of the change through the 301 code, so they can update their indexes to point to the new location.

302 Found

The HTTP status code 302 Found indicates that the resource you requested has been temporarily moved to a new location. When you encounter this code, your browser will automatically redirect you to the new address. This is a common way for websites to handle situations where a resource has been moved but they don't want to break links that point to the old location.

303 See Other

Indicates that the resource you requested has been moved to a different location. The server tells your browser to use a new URL to access the resource. This is usually a temporary redirection.

304 Not Modified

Indicates that the web resource you requested hasn't been updated since the last time your browser accessed it. This is a good thing! It saves time and bandwidth because your browser can use the cached version of the page instead of downloading it again from the server.

307 Temporary Redirect

This code is used to inform a web browser that the resource it requested has been temporarily moved to a different location. The browser should then resend the exact same request (including the method, like GET or POST) to the new URL provided by the server.

308 Permanent Redirect

It indicates that the resource you requested has been permanently moved to a new location. Your browser will automatically redirect you to the new address, and search engines will update their listings to point to the new location as well. This is helpful for websites that have changed their domain name or URL structure.

400 - 499 (Client Error)

400 Bad Request

The HTTP status code 400 Bad Request means the server encountered an error with the request it couldn't understand. It's like trying to order something from a menu that isn't there. The issue typically lies on the client-side, meaning there might be a mistake in how the request was formatted.

401 Unauthorized

The HTTP status code 401, also known as "Unauthorized", indicates that you lack the necessary authorization to access the requested resource. This typically means you need to provide a valid username and password to access the specific webpage or file.

402 Payment Required

The HTTP status code 402, also known as "Payment Required", indicates that you need to make a payment to access the requested resource. It's commonly used for situations like expired subscriptions or paywalled content. However, it's important to note that 402 is an experimental code and not widely adopted. Some websites might use different codes for payment issues.

403 Forbidden

A 403 Forbidden error message means you don't have permission to access the requested information on a server. It's like being told "no entry" by a bouncer at a club. This can happen for a few reasons, such as incorrect login credentials or trying to access a restricted area. The server understands your request, but it's refusing to grant access. In contrast, a 401 Unauthorized error means the server doesn't recognize your login credentials.

404 Not Found

Indicates that the server you contacted was unable to find the specific page or resource you requested. This could be due to a misspelling in the URL, a broken link, or the content being removed.

405 Method Not Allowed

It indicates that the server understood your request perfectly, but it cannot perform the specific action you asked for on the resource you requested. This usually happens because you used an incorrect HTTP method, like trying to use GET to submit a form (which typically uses POST). The server might also be configured to disallow the method you used entirely.

406 Not Acceptable

The HTTP status code 406, "Not Acceptable," means the server is unable to fulfill a request because it can't provide a response that matches the format requested by the client. This is usually specified in the client's "Accept" header, which tells the server what kind of data formats it can understand. For instance, the client might request a webpage in JSON format, but the server might only be able to provide HTML.

407 Proxy Authentication Required

The HTTP status code 407 means you tried to access a website through a proxy server that requires a username and password. But for some reason, the authentication failed. This could be because you didn't enter any credentials, entered the wrong ones, or there's an issue with the proxy server itself.

408 Request Timeout

The HTTP status code 408 means the server didn't receive a complete request from the client (your browser) within a certain time. This could be due to a slow internet connection, a busy server, or even a bug. The server shuts down the connection to free up resources.

409 Conflict

Indicates that the request you made could not be completed because it conflicted with the current state of the resource on the server. This could happen for a few reasons, such as trying to update a resource that has already been modified by someone else, or if there are inconsistencies in the data you're trying to upload.

410 Gone

The HTTP status code 410 "Gone" indicates that the resource you requested has been permanently removed from the server and is unlikely to be available again. This is different from a 404 "Not Found" error, which could be due to a temporary issue or a typo in the URL. In simpler terms, a 410 code means "This page is gone, and it's not coming back."

411 Length Required

The HTTP status code 411 means the server cannot understand your request because it's missing a specific piece of information. The missing information is the size of the data you're trying to send to the server, specified in the "Content-Length" header of your request.

412 Precondition Failed

The HTTP status code 412 indicates that a request couldn't be completed because certain conditions weren't met. These conditions are usually specified by the client (like a web browser) in the request headers, and could be based on things like the last modification date or a unique identifier for the resource.

413 Content Too Large

The HTTP status code 413 indicates that a server cannot process a request because the data accompanying the request (the content) is larger than the server can handle. This typically happens when uploading a large file that exceeds the server's file size limit.

414 URI Too Long

The HTTP status code 414 indicates that the URL you tried to access is too long for the server to understand. This is a relatively uncommon error. It typically occurs when a GET request is used with an excessively long query string.

415 Unsupported Media Type

The HTTP status code 415 means the server rejected a request because it couldn't understand the format of the data being sent. This typically happens when the data format (like an image or document) isn't compatible with what the server expects.

416 Range Not Satisfiable

The HTTP status code 416 means the server couldn't fulfill your request for a specific part of a resource. This typically occurs when you ask for a portion of a file (like a video) that doesn't exist, or if the server is configured to only deliver entire files.

417 Expectation Failed

It occurs when a specific condition set by the client in the request's "Expect" header isn't met by the server. In simpler terms, the client asked for something specific to happen before it would proceed with the request, and the server couldn't do it. This code is relatively uncommon.

421 Misdirected Request

The HTTP status code 421 indicates that the server you contacted isn't equipped to handle your request. This can happen due to various reasons like server misconfiguration or a mismatch between the server's capabilities and your request. In simpler terms, you've reached the wrong server!

422 Unprocessable Content

The HTTP status code 422 indicates that the server understands the format of your request but can't process it due to errors in the data itself. This could be due to missing information, invalid data formats, or violations of business rules.

423 Locked

The HTTP status code 423 indicates that the resource you're trying to access is currently unavailable because it's locked. This typically happens to prevent multiple users from modifying the same resource at the same time, like a document being edited collaboratively. It's a client-side error (4xx code), but the specific locking functionality is part of the WebDAV protocol, an extension for remote content authoring.

424 Failed Dependency

Indicates that an action could not be completed because it relied on another action that wasn't successful. Imagine you're trying to build a house, but you can't put on the roof until the walls are built. A 424 error would be like the supplier saying they can't deliver the roof shingles because the wall framing wasn't finished yet.

426 Upgrade Required

The HTTP status code 426 indicates that the server won't fulfill the request using the current protocol, but it might be willing to do so if the client upgrades to a different one. The server should provide information about the required protocol in the response.

428 Precondition Required

The HTTP status code 428 means the server needs the request to be formatted in a specific way. This usually involves sending a conditional request with headers like "If-Match", which checks if the data hasn't been changed since the client last saw it. This helps prevent conflicts where multiple users try to update the same data at the same time.

429 Too Many Requests

This code indicates that you've sent too many requests to a server in a short amount of time. This is a common way for websites to limit automated attacks or overuse by a single user. The server might also provide a suggested waiting time before you try sending another request.

431 Request Header Fields Too Large

This occurs when the information your browser sends along with your request to a website is too big for the server to handle. This information, called headers, contains things like cookies and information about your browser. The server rejects the request because processing a large header could be a security risk or overload the server.

451 Unavailable For Legal Reasons

This means the resource you requested is blocked due to legal issues, such as government censorship or copyright infringement. It's a way for servers to inform users that something is blocking access, rather than simply giving a generic error message.

500 - 599 (Server Error)

500 Internal Server Error

The HTTP status code 500 is a general error message. It indicates that the server encountered an unexpected problem and was unable to fulfill your request. This could be due to a variety of reasons on the server side, and the specific cause may not be very clear.

501 Not Implemented

This means the server you're trying to access doesn't understand or can't perform the specific request you sent. It's an error on the server-side, so you won't be able to fix it yourself.

502 Bad Gateway

The HTTP status code 502 indicates an error in communication between servers. It occurs when a server you're connected to (like a web server) acts as an intermediary and receives a bad response from another server it communicates with. This can happen due to various reasons like timeouts or overloaded servers.

503 Service Unavailable

The HTTP status code 503 indicates that the server is currently unavailable to handle your request. This is usually a temporary condition due to routine maintenance or the server being overloaded with traffic. In simpler terms, the website you're trying to access is busy or down for cleaning. The good news is that these issues are typically resolved quickly.

504 Gateway Timeout

The HTTP status code 504 indicates that a server acting as an intermediary (like a proxy or gateway) didn't receive a timely response from another server it needed to fulfill your request. In simpler terms, two servers are communicating, and one isn't responding fast enough.

505 HTTP Version Not Supported

The HTTP status code 505 indicates a communication issue between a client (like your web browser) and a server. Basically, the server doesn't understand the language the client is using to communicate (the HTTP version). This can happen if the server software is outdated or the client is using a very new version that the server isn't equipped for.

507 Insufficient Storage

This means the server doesn't have enough space to carry out your request, often due to limited disk space. It's associated with the WebDAV (Web Distributed Authoring and Versioning) protocol used for remote content editing.

508 Loop Detected

Indicates that the server encountered an infinite loop while processing a request. This typically happens with WebDAV, an extension for collaborative file editing on servers. In simpler terms, the server got stuck in a never-ending loop trying to fulfill your request and had to shut it down.

510 Not Extended

The HTTP status code 510 indicates that a server requires additional information to fulfill a request. This typically means the request lacked specific extensions or headers the server needs to process it. It's uncommon compared to other status codes.

511 Network Authentication Required

This code indicates that you need to go through some sort of authentication process to access the network. This might involve entering a username and password, agreeing to terms of service, or completing a CAPTCHA. You'll typically encounter this code on public Wi-Fi networks like those in coffee shops or airports. It's the network's way of controlling who can access it.