HTTP status codes

Contents
What a status code is
See the code of a page
1xx: Informational
2xx: Success
3xx: Redirection
4xx: Client error
5xx: Server error
Codes outside the standard

What a status code is

Every HTTP answer starts with a status line: the protocol version, a three-digit code and a short phrase for people, for example HTTP/1.1 404 Not Found. The first digit is the class. A client that does not know a code treats it like the x00 code of its class, so an unknown 499 is handled like 400. The codes and their names are defined in RFC 9110, HTTP Semantics, and in a few RFCs for extensions; IANA keeps the list.

See the code of a page

curl with -I asks for the headers only. Four answers of this site on a local test server:

curl -sI http://127.0.0.1:8080/i/nginx/install/ | head -1

HTTP/1.1 200 OK

curl -sI http://127.0.0.1:8080/linux/centos/iftop.php | grep -E '^(HTTP|Location)'

HTTP/1.1 301 Moved Permanently Location: http://127.0.0.1:8080/linux/centos/network/iftop.php

curl -sI http://127.0.0.1:8080/no-such-page/ | head -1

HTTP/1.1 404 Not Found

curl -sI http://127.0.0.1:8080/.htaccess | head -1

HTTP/1.1 403 Forbidden

In a browser, open the developer tools (F12), tab Network, and reload the page: the column Status shows the code of every file.

1xx: Informational

An interim answer: the request goes on, and the final answer follows.

CodeNameMeaning
100ContinueThe headers are fine, send the body. A client that sent Expect: 100-continue waits for it before uploading a large body.
101Switching ProtocolsThe server switches to the protocol from the Upgrade header, for example WebSocket.
102ProcessingWebDAV: still working, do not time out. Deprecated.
103Early HintsHeaders sent early, usually Link headers, so the browser can start loading styles and scripts while the page is being built.

2xx: Success

CodeNameMeaning
200OKThe request succeeded; the body has the result.
201CreatedA new resource was created; its address is in Location. A typical answer to POST, see PUT vs POST.
202AcceptedAccepted for processing that is not finished yet.
203Non-Authoritative InformationA proxy changed the answer of the origin server.
204No ContentDone, and there is nothing to send back.
205Reset ContentDone; the client should clear the form.
206Partial ContentOnly the requested byte range, see Content-Range. Used to resume downloads and to stream video.
207Multi-StatusWebDAV: several results in one XML body.
208Already ReportedWebDAV: this member was already listed earlier in the answer.
226IM UsedThe answer is a delta to an earlier version (RFC 3229).

3xx: Redirection

The client has to make another request, usually to the address in Location. How to set redirects up: Redirects.

CodeNameMeaning
300Multiple ChoicesSeveral versions exist, for example in different languages; the client may choose.
301Moved PermanentlyThe resource moved for good. Browsers may change a POST to GET on the way.
302FoundTemporarily elsewhere. Called Moved Temporarily in HTTP/1.0. Browsers may change a POST to GET.
303See OtherGet the result from another address with GET, for example after a form was sent.
304Not ModifiedThe copy in the cache is still current; no body. An answer to If-Modified-Since or If-None-Match.
305Use ProxyDeprecated; not followed by browsers for security reasons.
306(Unused)Used in an early draft, now reserved.
307Temporary RedirectTemporarily elsewhere; repeat the same method with the same body.
308Permanent RedirectMoved for good; repeat the same method with the same body.

4xx: Client error

Something is wrong with the request. Repeating it unchanged gives the same error.

CodeNameMeaning
400Bad RequestThe server cannot read the request: bad syntax, an invalid header, broken JSON.
401UnauthorizedAuthentication is missing or wrong; the WWW-Authenticate header says how to log in.
402Payment RequiredReserved for future use; some APIs use it for exhausted quotas.
403ForbiddenThe server understood and refuses: no rights, a blocked address, a protected file such as .htaccess, or a folder without an index page and without directory listing.
404Not FoundNothing at this address, or the server does not want to say that it exists.
405Method Not AllowedThe resource exists but not for this method; Allow lists the methods it takes.
406Not AcceptableNo version matches the Accept headers of the request.
407Proxy Authentication RequiredLike 401, but for a proxy.
408Request TimeoutThe client took too long to send the request.
409ConflictThe request conflicts with the current state, for example an edit of an outdated version.
410GoneRemoved for good, with no new address. Search engines drop it faster than a 404.
411Length RequiredContent-Length is missing.
412Precondition FailedA condition such as If-Match is false.
413Content Too LargeThe body is larger than the server accepts, for example a file upload. Formerly Payload Too Large.
414URI Too LongThe address is too long, often a GET with a huge query string.
415Unsupported Media TypeThe server cannot process the Content-Type of the body.
416Range Not SatisfiableThe requested byte range is outside the file.
417Expectation FailedThe Expect header cannot be met.
418(Unused)Reserved. Known as "I'm a teapot" from an April Fools' RFC.
421Misdirected RequestThe request reached a server that cannot answer for this host.
422Unprocessable ContentThe syntax is fine but the data is invalid, for example a failed form validation. Formerly Unprocessable Entity.
423LockedWebDAV: the resource is locked.
424Failed DependencyWebDAV: an earlier part of the request failed.
425Too EarlyThe server will not risk processing a request that may be replayed (TLS early data).
426Upgrade RequiredSwitch to the protocol named in Upgrade.
428Precondition RequiredThe request must be conditional, to avoid lost updates.
429Too Many RequestsRate limit hit; Retry-After says when to try again.
431Request Header Fields Too LargeOne header or all of them together are too large, often too many cookies.
451Unavailable For Legal ReasonsBlocked for legal reasons, for example a court order.

5xx: Server error

The request may be fine; the server failed. Its error log has the cause.

CodeNameMeaning
500Internal Server ErrorSomething broke on the server: a PHP fatal error, a wrong .htaccess line.
501Not ImplementedThe server does not support the method at all.
502Bad GatewayA proxy got no valid answer from the server behind it, for example Nginx when PHP-FPM or php-cgi is not running.
503Service UnavailableOverloaded or under maintenance; Retry-After may say for how long.
504Gateway TimeoutA proxy waited too long for the server behind it.
505HTTP Version Not SupportedThe server does not support the HTTP version of the request.
506Variant Also NegotiatesA configuration error in content negotiation.
507Insufficient StorageWebDAV: no space left to store the result.
508Loop DetectedWebDAV: an infinite loop while processing.
510Not ExtendedAn extension the request needs is missing. Historic.
511Network Authentication RequiredLog in to the network first, for example on a hotel or airport Wi-Fi page.

Codes outside the standard

Some programs and services use codes of their own. You meet them in logs and in error pages:

CodeWhereMeaning
419LaravelPage Expired: the CSRF token of a form is missing or too old.
449Microsoft IISRetry With: the request lacks information.
499NginxClient Closed Request: the client closed the connection before the answer, written only to the log.
509cPanel, Apache modulesBandwidth Limit Exceeded: the site used up its traffic.
520CloudflareWeb Server Returned an Unknown Error.
521CloudflareWeb Server Is Down: the origin refused the connection.
522CloudflareConnection Timed Out to the origin.
523CloudflareOrigin Is Unreachable.
524CloudflareA Timeout Occurred: the origin accepted the connection but answered too late.
525CloudflareSSL Handshake Failed with the origin.
526CloudflareInvalid SSL Certificate on the origin.

Microsoft IIS also writes sub-codes to its logs after a dot, such as 404.3; they never appear in the answer itself.

Article authors: Andrei Olegovich, Klavdiya Kondakova

Related articles
Responsive design: an adaptive menu
Beget mail: create a mailbox
Canonical page: rel=canonical
CSS
Firefox
Which hosting to choose
VPS hosting
HTTP status codes
Joomla
OpenCart
PUT vs POST
Redirects
Russian IP ranges
SEO
Element tbody not allowed as child of element table in this context
CSS test: shapes and line numbers
CSS test 2: the code blocks of this site
Website testing
A tram drawn with CSS
URL encoding
UTM tags
Telling bots from people
WebP images
Moving a website: domain and hosting
WordPress
Move a WordPress site
Yandex Metrica: goals
Yandex Mail: collect mail from other mailboxes

Search this site

Channel @aofeed Chat @aofeedchat

Contacts and cooperation:
I recommend our hosting beget.com
Write to info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: