HTTP Status Code Ranges
Fast recall
Quick revision
Core answer
1xx information, 2xx success, 3xx redirection, 4xx a request-side problem, and 5xx a server-side failure. The full code gives the exact meaning.Interview-ready guide
Interview answer
An HTTP status code is the standard summary at the start of a response. Valid codes run from 100 to 599. The first digit gives the broad class, and the whole three-digit code tells the exact result. Even if a client does not know a new code such as 471, it can still treat it as a 4xx response.
1xx codes are interim responses. They appear before the final response; for example, 100 Continue tells the sender to continue with the request content. 2xx means the request succeeded, but the exact success still matters: 200 OK usually returns a result, 201 Created reports a new resource, and 204 No Content sends no response content.
3xx means another step is involved. Some codes send the client to another URI, while 304 Not Modified tells a client that its stored response can still be used. This is why 3xx should not be remembered only as “a redirect page.”
4xx means the request cannot be completed because of a condition connected to the request or target. Examples include invalid syntax (400), missing valid credentials (401), and a target that was not found (404). 5xx means the server failed to fulfil an apparently valid request, such as a general failure (500) or temporary unavailability (503).
The range is only the first clue. An API client should use the exact status and the documented contract. An error body may add safe details, but it does not change 200 OK from an HTTP success into an HTTP error. A 5xx code also does not automatically make a retry safe; the HTTP method and the API's retry rules still matter.
HTTP Status Code Ranges
Direct Answer
HTTP status codes are three-digit response codes from 100 to 599. The first digit gives the broad result: 1xx information, 2xx success, 3xx redirection, 4xx a request-side problem, and 5xx a server-side failure. The full code gives the exact meaning.
Deep Dive & Architecture
A status code works in layers. The range is a rough category, the exact code is the protocol result, and the response headers and content add details for this occurrence. Generic software can understand the category, while application code can use the exact code.
For example, 404 Not Found belongs to 4xx, but its specific meaning is about the target resource—not simply “the user made a mistake.” The body can name the missing order in safe terms. It cannot change that response into success. This separation lets browsers, gateways, caches, logs, and application clients agree on the outcome.
The same idea prevents unsafe retry rules. 503 Service Unavailable often describes a temporary server problem, yet repeating a request that creates or charges something can duplicate work. A client must also consider whether the operation is safe or idempotent and whether the API supplies an idempotency key or a documented retry policy.
Code Example
HTTP/1.1 404 Not Found
Content-Type: application/json
{
"code": "ORDER_NOT_FOUND",
"message": "No order exists with id 42"
}
The status says that the target was not found. The JSON gives this API's safe, machine-readable detail.
Check your understanding
Answer these without looking back at the article.
- Can a response body change the meaning of a 200 status?
- Why is 304 in the 3xx class even though it does not supply a new redirect location?
- Does every 5xx response mean the client can safely retry?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.