HTTP Status Phrase to Code Lookup

Enter an HTTP reason phrase to find its numeric status code.

Result

502
5xx

How it is calculated

This is a reverse lookup: you type an HTTP reason phrase and the tool returns the numeric status code and its class. The phrase is trimmed and lower-cased, so capitalization and spaces around it do not matter, then matched against a fixed table of about 60 registered phrases. The class is ⌊code ÷ 100⌋ followed by xx, for example 5xx. There is no calculation or fuzzy matching: the whole phrase must match exactly, including spaces and hyphens (Multi-Status works, Multi Status does not). A number, an unknown phrase, or empty input gives no result. The current IANA / RFC 9110 names are matched, and the pre-2022 names Payload Too Large (413) and Unprocessable Entity (422) still work as aliases.

Worked example

You see "Bad Gateway" in a log line and want the code. The tool lower-cases and trims it to "bad gateway", finds it in the table, and returns code 502. The class is ⌊502 ÷ 100⌋ = 5, shown as 5xx. A 5xx class means the failure is on the server side (here, a gateway or proxy got a bad answer from an upstream server), not a mistake in the request. Typing " BAD GATEWAY " gives the same result.

Try this example →

Common mistakes

  • Typing the number (404) and expecting the phrase. This tool only goes from phrase to code and returns nothing for digits.
  • Using an alternative spelling that is not in the table, such as "Request Entity Too Large", "Request-URI Too Long" or "Gateway Time-out". Use the registered wording, for example "Content Too Large" or "URI Too Long".
  • Dropping a hyphen or adding punctuation. "Multi Status" and "Not Found." both find nothing, while "Multi-Status" and "Not Found" work.
  • Typing the name IANA lists for 418, "(Unused)". It is not matched, because 306 carries the same label; use "I'm a teapot" for 418.
  • Using a curly apostrophe in "I'm a teapot". Use a plain apostrophe (I'm a teapot) or leave it out (im a teapot); both give 418.

Sources

About this calculator

Every HTTP status code defined in RFC 9110 (and its predecessors RFC 7231 and RFC 2616) pairs a three-digit numeric code with a standard reason phrase — “200 OK”, “404 Not Found”, “502 Bad Gateway” — and this tool performs the reverse lookup: type the phrase (capitalization doesn't matter), get the code and its class, shown as the hundred it belongs to — 1xx Informational, 2xx Success, 3xx Redirection, 4xx Client Error, 5xx Server Error. It covers the standard registered phrases, including less common ones like “418 I'm a Teapot” and “429 Too Many Requests”, and it accepts both the current RFC 9110 / IANA wording “Content Too Large” (413) and “Unprocessable Content” (422) and the older names “Payload Too Large” and “Unprocessable Entity”.

Backend developers, API designers and DevOps engineers reach for this when reading a log line or error message that only shows the phrase, when writing API documentation, or when deciding which code class to return from a new endpoint — knowing that a phrase falls in the 400s immediately signals a client-side problem rather than a server fault, which changes how monitoring and alerting should treat it.

Was this helpful?

You can pick up to 3 reactions.

Note from the editors

Matching is exact against a fixed list of the current registered names plus a few older aliases, so some phrases you meet in older documentation return nothing. Examples that come back empty are Moved Temporarily and Request-URI Too Long, while Unprocessable Content, Unprocessable Entity and URI Too Long work. The first digit still tells you whether to look at the client or the server. If a phrase from your logs returns nothing, tell us which one.

Comments

  • Be the first to comment.

Popular calculators

All Calculators