designwithfocus

Domains, hosting & DNS

HTTP Status Codes Explained, from 200 to 503

By Design With Focus Team 9 min read
A browser address bar with a 200 response beside a 404 page

Short answer

An HTTP status code is a three-digit result that says whether a request finished, must move, or failed. RFC 9110 groups codes in five classes, from informational 1xx through server error 5xx. A 200 means the request succeeded, 301 and 302 send the client elsewhere, 404 means the resource was not found, and 503 means the server is not ready.

Last verified against the sources listed below.

Key takeaways

  • RFC 9110 says 2xx means the request was received, understood, and accepted.
  • 3xx means the user agent must take further action to fulfill the request.
  • 4xx means the client seems to have erred. 5xx means the server failed or cannot perform the method.
  • MDN says 200's meaning depends on the method. GET sends the resource. HEAD sends headers only.
  • 301 is a permanent new URL. 302 is a temporary change, and the client should keep using the old URI later.
  • 503 should be temporary. MDN says to send Retry-After when you can, and not to cache that response as if it were final.

HTTP status codes explained in one line: a three-digit code on the response says which class of result the server is returning. RFC 9110 defines the classes. MDN’s status list gives the reason phrase and the practical meaning for each common code.

The first digit is the class. 1xx is informational, 2xx is success, 3xx is redirection, 4xx is a client error, and 5xx is a server error. Codes outside that pattern are non-standard. MDN says if you see one that is not on its list, it may be custom to that server.

IANA’s HTTP status code registry records the reason phrases and points 200, 404, and 503 at RFC 9110. 200 is OK, 404 is Not Found, and 503 is Service Unavailable.

A 200 can still carry a large file. An image compressor shrinks a body you intend to send with a success status. The status code does not compress anything.

HTTP status codes and their meaning

HTTP status codes and their meaning start with the class sentences in RFC 9110.

The 1xx class is an interim response about connection status or progress, sent before the final response. It cannot contain content. A server must not send 1xx to an HTTP/1.0 client. MDN’s 100 Continue tells the client to continue the request, or to ignore the interim response if the request already finished.

The 2xx class means the request was successfully received, understood, and accepted. The 3xx class means the user agent has to take further action to fulfill the request. The 4xx class means the client seems to have erred, and the server should send an explanation except for HEAD. The 5xx class means the server is aware that it has erred or cannot perform the method.

How the internet works is the delivery of that response. The status line is the part a client branches on before it reads the body.

Codes you will actually handle

Code Class Meaning, from MDN unless noted
200 2xx The request succeeded. For GET, RFC 9110 says the content represents the target resource. HEAD sends no body.
201 2xx The request succeeded and a new resource was created. Typical after POST, and after some PUT requests.
204 2xx No content to send. Headers may still update a cache.
301 3xx The URL changed permanently. The new URL is in the response.
302 3xx The URI changed temporarily. Later requests should still try the original URI.
304 3xx Not modified. The client keeps its cached copy.
307 3xx Temporary redirect that must keep the same method.
308 3xx Permanent redirect that must keep the same method.
400 4xx The server will not process the request because it looks like a client error, such as malformed syntax.
401 4xx Unauthenticated. The client must authenticate. The phrase “Unauthorized” is the historical name.
403 4xx The server knows the client and refuses access.
404 4xx The server cannot find the resource. APIs also use it when the endpoint exists and the item does not.
405 4xx The method is known but not allowed on this resource.
500 5xx The server hit a situation it does not know how to handle.
502 5xx A gateway received an invalid response while fetching what it needed.
503 5xx The server is not ready, often maintenance or overload. Temporary.

MDN notes that 404 is the code people recognize because it shows up so often. It also says a server may send 404 instead of 403 to hide a resource from a client that is not allowed to know it exists.

200, and what success includes

RFC 9110 says the 200 (OK) status code indicates that the request has succeeded, and that the content depends on the method. For GET, the content is a representation of the target resource. For HEAD, the headers match GET and the body is absent. For PUT or POST, MDN says the body is a representation of the result of the action.

201 is the success code when the action created a resource. 204 is the success code when there is nothing to put in the body. 202, on MDN, means the server accepted the request and has not acted yet.

That is still 2xx. It is not a promise that the work later succeeds, because HTTP has no later status for that same request.

A page that returns 200 with an error message in the HTML is lying to every client that trusts the class. Crawlers and scripts will treat it as the real resource. If the URL should not exist, use 404. If it moved, use a redirect.

Redirects, from 301 to 308

MDN says 301 means the URL changed permanently and the new URL is given in the response. 302 means a temporary change, and the client should use the same URI on future requests. The practical bug is choosing 302 for a move you will never undo. Clients and caches are allowed to treat a permanent redirect as a long-term replacement.

307 and 308 exist so the method survives. MDN says 307 has the same semantics as 302 except the client must not change the method. A POST stays a POST.

308 is the permanent version of that rule, paired with 301’s meaning. If a form POST becomes a GET after a redirect, you likely sent 301 or 302.

304 is the cache code. MDN says it tells the client the response has not been modified, so the cached copy is still good. It is not a missing page. Technical SEO cares about this set because a permanent redirect, a soft 404, and a real 404 tell a crawler different things.

Client errors, from 400 to 405

MDN says 400 means the server cannot or will not process the request because it sees a client error: malformed syntax, invalid framing, or deceptive request routing. 401 means the client is not authenticated. 403 means it is authenticated, or otherwise known, and still not allowed.

404 means the resource was not found. 405 means the method is not allowed on that target, for example DELETE on a resource that does not support it, or TRACE when the server disables it.

RFC 9110 says that for 4xx, except on HEAD, the server should send a representation that explains the error and whether it is temporary or permanent. A bare status line with an empty body meets the code and fails the person reading it.

Do not use 400 as a bucket for “anything but success.” A missing item is 404. A wrong method is 405. A missing login is 401. The more specific code is the one clients and logs can branch on.

Server errors, from 500 to 503

MDN says 500 is the generic server failure, used when no more specific 5xx fits. 501 means the method is not implemented. Servers must support GET and HEAD, so those two methods must not produce 501.

502 means a gateway got a bad response from the server it called. 503 means this server is not ready. 504 means a gateway timed out waiting.

MDN says 503 should be temporary, that a human-readable explanation should go with it, and that Retry-After should carry an estimate when you have one. Cache headers matter because an outage page should not be stored as the normal document. 500 is for the bug you did not classify. 503 is for the outage you did.

If the situation is Send Not
The GET worked and the body is the resource 200 204, which promises no body
You created a resource 201 200, unless you are not claiming creation
The URL moved forever and GET may change to GET 301 302, which is temporary
The URL moved forever and POST must stay POST 308 301, which does not keep the method rule
The item does not exist 404 200 with an error paragraph
The user is not logged in 401 403, which means you know them
You are deployed and briefly down 503 500, if you know it is temporary
Your gateway’s upstream answered garbage 502 503, which describes your own readiness

Mistakes that confuse clients

Returning 200 for a missing page hides the error from caches and from crawlers. MDN’s 404 definition is the one that matches “not found.” A redirect without a new URL in the response does not give the client the further action RFC 9110 says a 3xx requires.

Using 302 for a permanent move keeps the old URI in the client’s future requests, which is what MDN says 302 means. Using 301 for a form POST can change the method. If the method must survive, MDN points you to 307 or 308.

Sending 500 for maintenance throws away the temporary signal. MDN reserves 503 for the not-ready case and asks for Retry-After when you can estimate the return. None of these codes fix a slow image. They only tell the client what the response is.

Frequently asked questions

What are HTTP status codes and their meaning?

HTTP status codes and their meaning are defined as classes in RFC 9110 and as individual codes on MDN's status page. 1xx is an interim progress response and cannot carry content. 2xx means success. 3xx means the client must do something else, usually follow a Location. 4xx means the request looks wrong. 5xx means the server knows it failed. The first digit is the class. The other two digits name the case inside that class.

What are HTTP status codes and meaning for redirects?

MDN says 301 means the resource's URL changed permanently and the new URL is in the response. 302 means the URI changed temporarily, so later requests should still use the original URI. 307 is like 302 except the client must not change the method. 308 is like 301 with that same method rule. 304 is not a move. It tells a cache that the representation has not been modified. Use 301 or 308 when the old URL should be retired.

Is 401 the same problem as 403?

MDN says 401 means unauthenticated, even though the reason phrase says Unauthorized. The client must authenticate to get the response. 403 means the server knows who the client is and still refuses. A missing login is 401. A logged-in user who is not allowed is 403. MDN also says servers sometimes send 404 instead of 403 so they do not reveal that the resource exists. Pick the code that matches what you are willing to disclose.

When is 503 a better response than 500?

MDN says 500 means the server hit a situation it does not know how to handle, and it could not find a more specific 5xx code. 503 means the server is not ready, often for maintenance or overload. 503 is for a temporary condition. MDN says to include Retry-After when you can, and to be careful with cache headers so clients do not store the outage page as the normal representation. 502 is different again: a gateway got an invalid response from upstream.

Does a 200 prove the page is the one you wanted?

RFC 9110 says 200 means the request succeeded, and for GET the content is a representation of the target resource. Success is about the request the server understood, not about whether a human likes the page. A soft error page that returns 200 still looks successful to a client that only checks the class. If the resource is gone, MDN's 404 is the code for not found. If it moved, use a 3xx and a Location.

Sources