HTTP Status Codes Explained

What the five status-code classes (1xx-5xx) mean, how to read a status line, and the quick rules you use to debug with them.

An HTTP status code is a three-digit number the server returns to summarize how it handled the client's request. It sits on the first line of every HTTP response — the status line — alongside a short reason phrase, such as 200 OK or 404 Not Found. The reason phrase is a human-readable hint only; programs make decisions based on the numeric code, not the text.

The five classes

Codes are grouped into five classes by their first digit. The design lets you grasp the general outcome from that digit alone, so even an unfamiliar code carries meaning at a glance.

Reading a status line

A status line has the form HTTP-version status-code reason-phrase. Here is a typical response as shown by curl -i:

HTTP/1.1 404 Not Found
Content-Type: application/json
Content-Length: 42

{"error":"user not found","id":"u_92311"}

The key habit is to read the leading digit first. A 4 means the client's request is at fault; the trailing 04 narrows it to 'the target resource does not exist.' Before blaming the server, suspect a wrong URL or identifier.

Quick rules for debugging

Because status codes are a shared vocabulary defined by the standard (RFC 9110), clients and servers can communicate without knowing each other's internals. That said, many APIs bend the semantics, so treat the code as a first signal and always read the detailed error message in the body.