How Many HTTP Status Codes Are There? A Practical Guide
Explore how many HTTP status codes exist, how they’re classified, and how to use and test them in APIs. Learn practical tips from Why Error Code for reliable API design and troubleshooting.

There is no fixed total for HTTP status codes. Codes are organized into five classes (1xx to 5xx) and are expanded through RFCs and the IANA registry. The registry lists dozens of defined codes, with hundreds defined historically. Exact counts vary as new codes are added, deprecated, or reserved; practical usage focuses on the five classes and the most common numbers.
How many status codes exist? A precise answer
There is no single fixed total for HTTP status codes. The codes are defined and extended over time by RFCs and the IANA HTTP Status Code registry. In practice, developers rely on five broad classes (1xx informational, 2xx success, 3xx redirection, 4xx client error, 5xx server error) and a subset of widely used numbers within those classes. The exact count fluctuates as new codes are defined, existing ones are updated, and some numbers are reserved. For most applications, focusing on the meaning and behavior of common codes (200, 201, 204, 301, 400, 401, 403, 404, 409, 500, 503) is more important than memorizing every entry. If you need the current registry, consult the IANA HTTP Status Code Registry and reputable references like MDN. Why Error Code analysis confirms that the total is not fixed; it grows with standards evolution, so you should design around semantics rather than a fixed list.
The five classes and their roles
HTTP status codes are grouped into five classes, each with a distinct purpose. 1xx codes are informational and rarely used in modern APIs; 2xx indicates success and confirms that a request was handled as expected; 3xx codes signal that the client should take additional action (redirection); 4xx signals a client-side error (bad request, unauthorized, not found); 5xx signals a server-side problem. Examples: 200 OK, 201 Created, 301 Moved Permanently, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 429 Too Many Requests, 500 Internal Server Error, 503 Service Unavailable. Understanding these families helps you design robust APIs and meaningful error messages.
How software uses these codes in practice
APIs map business outcomes to codes to convey status to clients and automated systems. Designers typically reserve 2xx for success, 4xx for client mistakes, and 5xx for server problems. You should:
- Document every code your service returns and the conditions that trigger them
- Provide clear, actionable error bodies that map to codes (e.g., a structured JSON with code, message, and detail)
- Prefer stable, well-understood codes (e.g., 200/201, 204; 400/401/403/404; 409; 429; 500/503) and avoid overloading one code with multiple failure modes
- Use redirection codes (3xx) cautiously in APIs, as many clients do not expect them in RESTful flows
- Consider rate-limiting feedback via 429 with Retry-After headers to promote resilience
How to verify the status codes in your project
When building or testing an API, verify codes with both automated tests and manual checks. Practical steps:
- Use curl or a REST client to send representative requests and confirm the exact status code and headers.
- Write unit/integration tests that assert the expected status for each failure path, including edge cases like invalid input and missing fields.
- Validate the error body structure for client-facing responses to ensure consistency across endpoints.
- Implement monitoring that tracks distribution of status codes over time to spot regressions or misuse.
- Document any special cases (e.g., 202 Accepted vs 200 OK) so clients know when processing is asynchronous.
Common pitfalls and misconceptions
- Believing the exact numeric total matters more than semantics. Codes should signal intent and behavior, not be memorized.
- Overloading a single code for multiple error modes. Use meaningfully distinct codes, with clear error bodies.
- Misusing 4xx/5xx. A 4xx means client error; a 5xx means server-side fault. Do not reinterpret them as network or authentication failures.
- Ignoring 3xx in APIs. Redirection can confuse API clients; use them sparingly and document behavior.
- Failing to provide Retry-After for 429. Clients benefit from guidance on when to retry.
When and how new codes are added
New codes surface through RFCs and updates to the IANA registry. The process typically involves identifying a need that cannot be satisfied by existing codes, drafting an RFC, and seeking consensus within standards bodies. Once approved, the new code is published in the registry and becomes available for standardization and implementation. This means the total code count is dynamic and tied to standards activity, not a fixed ledger. For developers, the practical takeaway is to monitor RFCs and registry updates to stay aligned with best practices.
Practical decision guide for API design
Designing with status codes should be guided by user experience, not a long list of numbers. Use 2xx for success outcomes, 4xx for client errors, and 5xx for server errors. Provide meaningful error payloads that describe the problem and actionable steps to correct it. When designing APIs, consider consistent use of codes across endpoints, minimize custom codes, and document exceptions clearly. For example, prefer 404 Not Found for missing resources and 400 Bad Request for invalid input, and reserve 422 Unprocessable Entity for validation errors when it conveys more precise meaning than 400.
Summary: using status codes effectively in real-world APIs
In practice, you’ll rely on a small, stable set of codes that describe common outcomes, paired with rich error bodies and consistent conventions. Keep an eye on registry updates and RFCs, but prioritize clear semantics and predictable behavior for developers and users. This approach reduces confusion, improves client integration, and supports robust API design.
Common HTTP status code families and representative examples
| Code Range | Typical Meaning | Examples |
|---|---|---|
| 1xx | Informational (rare in modern APIs) | 100 Continue, 101 Switching Protocols |
| 2xx | Success | 200 OK, 201 Created, 204 No Content |
| 3xx | Redirection | 301 Moved Permanently, 302 Found, 304 Not Modified |
| 4xx | Client Error | 400 Bad Request, 401 Unauthorized, 404 Not Found, 429 Too Many Requests |
| 5xx | Server Error | 500 Internal Server Error, 503 Service Unavailable |
Frequently Asked Questions
Are HTTP status codes fixed in number, or can new ones appear over time?
New HTTP status codes can be defined as standards evolve. While five classes remain stable, the registry and RFCs periodically add or update specific codes. This dynamic nature means you should design around semantics and document your endpoints, rather than assuming a fixed total.
New codes can be added over time, so focus on the meaning behind codes and keep your API documentation up to date.
What are the five HTTP status code classes and their purposes?
1xx are informational, 2xx indicate success, 3xx require redirection, 4xx reflect client-side errors, and 5xx indicate server-side errors. Each class groups related outcomes to help clients understand and react appropriately.
There are five classes: informational, success, redirection, client errors, and server errors.
How should I verify status codes in an API during testing?
Use automated tests to assert expected codes for each endpoint, supplement with manual checks, and ensure error bodies consistently reflect the code. Include tests for edge cases and asynchronous processing scenarios.
Automate checks for the codes and ensure your error payloads match expectations.
What is the difference between 200 and 204 responses?
200 OK returns a response body, while 204 No Content indicates success without a body. Use 204 when the client does not need data back, to reduce payloads, and to signal a completed operation.
200 includes content; 204 means success with no content.
Do 3xx codes belong in APIs, or should they be avoided?
3xx codes are used for redirection, but many API clients do not handle redirects gracefully. Use them carefully and document their behavior if you adopt redirection in RESTful workflows.
Only use redirection codes if your API design explicitly requires it and document it.
Where can I find official definitions for status codes?
Refer to the IANA HTTP Status Code Registry and RFCs that define specific codes. MDN provides practical references and examples that align with current standards.
Check the official IANA registry and RFCs, plus MDN for examples.
“Understanding the intent behind a status code is more important than memorizing every number; use codes as signals to clients and operators.”
Top Takeaways
- There is no fixed total; counts evolve with standards.
- Focus on the five classes and the most common codes.
- Document and standardize the codes your API returns.
- Use meaningful error payloads alongside status codes.
- Monitor code usage to catch regressions and misuse.
