HTTP Status Codes
Interactive HTTP status code reference
1xx Informational
2xx Success
3xx Redirection
4xx Client Error
5xx Server Error
How to use the HTTP Status Codes Reference
- •Browse by category using the grouped sections: 1xx Informational, 2xx Success, 3xx Redirection, 4xx Client Error, and 5xx Server Error.
- •Search for a specific code by typing the status number or a keyword (like "not found" or "unauthorized") in the search field.
- •Click on any status code to see its detailed description, common causes, and usage guidance.
- •Use it as a reference during development, debugging, or API design to ensure you are returning semantically correct status codes.
What are HTTP Status Codes?
HTTP status codes are three-digit numbers returned by a web server in response to a client's request. They are defined in RFC 9110 (which superseded RFC 7231) and are fundamental to how the web works. Every time your browser loads a page, submits a form, or calls an API, the server responds with a status code indicating the outcome.
The codes are organized into five classes:
1xx (Informational): The request was received and the server is continuing to process it. 100 Continue tells the client to proceed with sending the request body. 101 Switching Protocols is used in WebSocket handshakes.
2xx (Success): The request was successfully received, understood, and accepted. 200 OK is the standard success response. 201 Created indicates a new resource was created (common in REST APIs after POST requests). 204 No Content means success with no response body (common for DELETE operations).
3xx (Redirection): The client must take additional action to complete the request. 301 Moved Permanently tells search engines and browsers to update their records. 302 Found (temporary redirect) and 304 Not Modified (use your cached version) are also common.
4xx (Client Error): The request contains an error on the client's side. 400 Bad Request for malformed syntax, 401 Unauthorized for missing authentication, 403 Forbidden for insufficient permissions, 404 Not Found for nonexistent resources, and 429 Too Many Requests for rate limiting.
5xx (Server Error): The server failed to fulfill a valid request. 500 Internal Server Error is the generic catch-all. 502 Bad Gateway means an upstream server sent an invalid response. 503 Service Unavailable indicates temporary overload or maintenance.
Common use cases
- •API design: Choosing the correct status code for each endpoint response is a core part of RESTful API design. This reference helps you select semantically appropriate codes.
- •Debugging failed requests: When an API call returns an unexpected status code, looking up its meaning is the first step in diagnosing the issue.
- •Monitoring and alerting: DevOps engineers configure alerts based on status code patterns. A spike in 5xx errors indicates a server problem; increased 4xx errors may signal a broken client integration.
- •SEO and web crawling: Understanding 301 vs. 302 redirects is critical for SEO. Incorrect redirects can cause search engines to lose page ranking.
FAQ
Q: What is the difference between 401 and 403?
A: 401 Unauthorized means the request lacks valid authentication credentials -- the user needs to log in. 403 Forbidden means the user is authenticated but does not have permission to access the resource. Despite the confusing name, 401 is about authentication, not authorization.
Q: When should I use 404 vs. 410?
A: Use 404 Not Found when a resource does not exist and may or may not have existed before. Use 410 Gone when you know the resource previously existed but has been permanently deleted. The 410 status tells search engines to remove the URL from their index more quickly.
Q: Is it bad practice to always return 200 with an error in the body?
A: Yes. This is a common anti-pattern in APIs. Returning 200 OK with {"error": "not found"} in the body defeats the purpose of status codes. HTTP clients, proxies, CDNs, and monitoring tools rely on status codes to understand responses without parsing the body.
Is my data safe?
Yes. This tool runs entirely in your browser. Your data is never sent to our servers.
How to use the HTTP Status Codes Reference
- Browse by category using the grouped sections: 1xx Informational, 2xx Success, 3xx Redirection, 4xx Client Error, and 5xx Server Error.
- Search for a specific code by typing the status number or a keyword (like "not found" or "unauthorized") in the search field.
- Click on any status code to see its detailed description, common causes, and usage guidance.
- Use it as a reference during development, debugging, or API design to ensure you are returning semantically correct status codes.
What are HTTP Status Codes?
HTTP status codes are three-digit numbers returned by a web server in response to a client's request. They are defined in RFC 9110 (which superseded RFC 7231) and are fundamental to how the web works. Every time your browser loads a page, submits a form, or calls an API, the server responds with a status code indicating the outcome.
The codes are organized into five classes:
1xx (Informational): The request was received and the server is continuing to process it. 100 Continue tells the client to proceed with sending the request body. 101 Switching Protocols is used in WebSocket handshakes.
2xx (Success): The request was successfully received, understood, and accepted. 200 OK is the standard success response. 201 Created indicates a new resource was created (common in REST APIs after POST requests). 204 No Content means success with no response body (common for DELETE operations).
3xx (Redirection): The client must take additional action to complete the request. 301 Moved Permanently tells search engines and browsers to update their records. 302 Found (temporary redirect) and 304 Not Modified (use your cached version) are also common.
4xx (Client Error): The request contains an error on the client's side. 400 Bad Request for malformed syntax, 401 Unauthorized for missing authentication, 403 Forbidden for insufficient permissions, 404 Not Found for nonexistent resources, and 429 Too Many Requests for rate limiting.
5xx (Server Error): The server failed to fulfill a valid request. 500 Internal Server Error is the generic catch-all. 502 Bad Gateway means an upstream server sent an invalid response. 503 Service Unavailable indicates temporary overload or maintenance.
Common use cases
- API design: Choosing the correct status code for each endpoint response is a core part of RESTful API design. This reference helps you select semantically appropriate codes.
- Debugging failed requests: When an API call returns an unexpected status code, looking up its meaning is the first step in diagnosing the issue.
- Monitoring and alerting: DevOps engineers configure alerts based on status code patterns. A spike in 5xx errors indicates a server problem; increased 4xx errors may signal a broken client integration.
- SEO and web crawling: Understanding 301 vs. 302 redirects is critical for SEO. Incorrect redirects can cause search engines to lose page ranking.
FAQ
Q: What is the difference between 401 and 403?
A: 401 Unauthorized means the request lacks valid authentication credentials -- the user needs to log in. 403 Forbidden means the user is authenticated but does not have permission to access the resource. Despite the confusing name, 401 is about authentication, not authorization.
Q: When should I use 404 vs. 410?
A: Use 404 Not Found when a resource does not exist and may or may not have existed before. Use 410 Gone when you know the resource previously existed but has been permanently deleted. The 410 status tells search engines to remove the URL from their index more quickly.
Q: Is it bad practice to always return 200 with an error in the body?
A: Yes. This is a common anti-pattern in APIs. Returning 200 OK with {"error": "not found"} in the body defeats the purpose of status codes. HTTP clients, proxies, CDNs, and monitoring tools rely on status codes to understand responses without parsing the body.
Is my data safe?
Yes. This tool runs entirely in your browser. Your data is never sent to our servers.