HTTP Status Codes

Complete reference of all HTTP status codes with descriptions and use cases.

What are HTTP Status Codes?

HTTP status codes are three-digit numeric responses that a web server sends to the browser or client when a request is made. These codes indicate whether the request was successful, if there was an error, or if additional action is required. Understanding these codes is essential for web developers, system administrators, and SEO specialists.

Codes are grouped into five categories based on their first digit: 1xx (Informational) indicate that the request was received and processing continues; 2xx (Success) confirm that the request was completed successfully; 3xx (Redirection) indicate that additional action is needed, usually a redirect; 4xx (Client Error) signal that there was a problem with the request sent; and 5xx (Server Error) indicate that the server could not complete a valid request.

Most Common Codes

200 OK: The request was successful. It's the most common code and means the resource was delivered correctly.

301 Moved Permanently: The resource has been permanently moved to a new URL. It's crucial for SEO because it transfers "link juice" to the new location.

404 Not Found: The requested resource doesn't exist. It's the most common error users encounter while browsing the web.

500 Internal Server Error: Generic server error when something goes wrong but the server can't be more specific.

Frequently Asked Questions

What is the difference between 301 and 302?

301 indicates a permanent redirect (the resource has been moved permanently), while 302 indicates a temporary redirect. For SEO, 301 transfers ranking and authority to the new URL, while 302 does not because the change is assumed to be temporary.

What does the 418 I'm a teapot code mean?

It's a real but uncommon HTTP error code, defined in RFC 2324 as an April Fools' joke from 1998. It indicates that the server is a teapot and cannot brew coffee. Although it's a joke, some servers implement it as an Easter egg.

How can I view status codes in my browser?

You can use the browser's developer tools (F12 or Ctrl+Shift+I) and navigate to the "Network" tab. When you reload the page, you'll see all HTTP requests and their corresponding status codes. You can also use tools like curl with the -I option to view only response headers.

What code should I use for a REST API?

For REST APIs, use 200 for success, 201 for successful creation, 204 for success with no content, 400 for malformed requests, 401 for required authentication, 403 for access denied, 404 for resources not found, and 500 for internal server errors. Following these conventions makes your API more predictable and easier to use.