HTTP: HTTP Status Codes

Every HTTP response comes with a status code that signals with a clear number information about how the request was processed.

An HTTP status code is the first line in an HTTP response, that’s sent from a server to the client.

This list will be useful if you are trying to find out why a server sent a particular status code, and see what does it mean, or if you are building the server and you are browsing for the perfect status code to return.

Status codes are expressed through 3-digit numbers, plus a short description.

The first digit of the number identifies the response group.

There are 5 groups:

  • 1xx: informational response - indicates that the request was received and understood
  • 2xx: successful response - indicates the action requested by the client was received, understood and accepted
  • 3xx: redirection - indicates the client must take additional action to complete the request
  • 4xx: client error - indicates there was an error, that seems to have been caused by the client
  • 5xx: server error - indicates that an error happened on the server

In the rest of the post I list all the useful status codes.

(I removed some technology-specific ones, like the WebDAV ones, and the ones very rarely used)

Informational responses

Status codeDescription
100 ContinueThe server has received the request headers and the client should proceed to send the request body (in the case of a request for which a body needs to be sent; for example, a POST request). Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient. To have a server check the request’s headers, a client must send Expect: 100-continue as a header in its initial request and receive a 100 Continue status code in response before sending the body. If the client receives an error code such as 403 (Forbidden) or 405 (Method Not Allowed) then it shouldn’t send the request’s body. The response 417 Expectation Failed indicates that the request should be repeated without the Expect header as it indicates that the server doesn’t support expectations (this is the case, for example, of HTTP/1.0 servers).
101 Switching ProtocolsThe client asked the server to switch protocols and the server has agreed to do so. See RFC 7231#6.2.2

Successful responses

Status codeDescription
200 OKThis is the standard response for successful HTTP requests.
201 CreatedTypically a response to a POST request. The request has been completed, and a new resource has been created.
202 AcceptedThe request has been accepted for processing. There’s nothing said about the actual processing, and the result of that, which might happen on a separate server, or batched.
203 Non-Authoritative InformationThe original server returned a 200, and a transforming proxy between the client and the server changed the payload
204 No ContentThe server successfully processed the request, but is not returning any content.
205 Reset ContentThe server successfully processed the request, but is not returning any content. Similar to a 204 response, but the server requires that the client resets the document view (used to clear forms, for example)
206 Partial ContentIn response to a Range request coming from the client, the server sends a partial content response. See RFC 7233#4.1


Status codeDescription
301 Moved PermanentlyThis and all future requests should be directed to the given URI. Only use with GET/HEAD requests, and 308 Permanent Redirect for all the other methods.
302 FoundThe resource is temporarily moved to a URL specified by the Location header. Only use with GET/HEAD requests, and 307 Temporary Redirect for all the other methods.
303 See OtherAfter a POST or PUT request, points to the confirmation message in the Location header, accessible using a new GET request.
304 Not ModifiedWhen the client uses the request headers If-Modified-Since or If-None-Match, this response status code indicates that the resource has not been modified.
307 Temporary RedirectSimilar to the 302 request, except it does not allow changing the HTTP method
308 Permanent RedirectSimilar to the 301 request, except it does not allow changing the HTTP method

Client errors

Status codeDescription
400 Bad RequestDue to a request error that was generated on the client, the server cannot process the request. Errors can include a malformed request, size too large to be handled, or others.
401 UnauthorizedSent when authentication is required and the client is not authorized
403 ForbiddenThe resource is not available for various reasons. If the reason is authentication, prefer the 401 Unauthorized status code.
404 Not FoundThe requested resource could not be found.
405 Method Not AllowedThe resource is not available through that HTTP method, but might be with another.
406 Not AcceptableThe client passed an Accept header with values that are not compatible with the server.
407 Proxy Authentication RequiredBetween the client and the server there is a proxy that requires authentication.
408 Request TimeoutThe server timed out waiting for the request.
409 ConflictIndicates that the request could not be processed because of conflict in the current state of the resource, such as an edit conflict between multiple simultaneous updates.
410 GoneThe resource is no longer available and will not be available again. More powerful than a 404, for example search engines interpret it as an indication to remove that resource from their index.
411 Length RequiredThe client needs to add a Content-Length header to the request, and it was required.
412 Precondition FailedReturned if the client sent an If-Unmodified-Since or If-None-Match request header, and the server cannot satisfy that condition.
413 Payload Too LargeThe request is larger than the server is willing or able to process.
414 URI Too LongThe URI provided was too long for the server to process.
415 Unsupported Media TypeThe request entity has a media type which the server or resource does not support.
416 Range Not SatisfiableThe client has asked for a portion of the file using the Range header, but the server cannot supply that portion.
417 Expectation FailedThe server cannot meet the requirements of the Expect request header.
421 Misdirected RequestThe request was directed at a server that is not able to produce a response (for example because of connection reuse).
426 Upgrade RequiredThe client should switch to a different protocol such as TLS/1.0, specified in the Upgrade header field.
428 Precondition RequiredThe server requires the request to contain a If-Match header.
429 Too Many RequestsThe user has sent too many requests in a given amount of time. Used for rate limiting.
431 Request Header Fields Too LargeThe request cannot be fulfilled because one or more headers, or the whole headers set, is too large.
451 Unavailable For Legal ReasonsThe resource is not available due to legal reasons

Server errors

Status codeDescription
500 Internal Server ErrorA generic server error message, given when an unexpected condition was encountered and no more specific message is suitable.
501 Not ImplementedThe server either does not recognize the request method, or it lacks the ability to fulfil the request.
502 Bad GatewayThe server was acting as a gateway or proxy and received an invalid response from the upstream server.
503 Service UnavailableThe server is currently temporarily unavailable (because it is overloaded or down for maintenance).
504 Gateway TimeoutThe server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
505 HTTP Version Not SupportedThe server does not support the HTTP protocol version specified in the request.

Lessons in this unit:

0: Introduction
1: An HTTP request
2: HTTP Methods
3: ▶︎ HTTP Status Codes
4: HTTP Client/Server communication
5: HTTP Request Headers
6: HTTP Response Headers
8: HTTP/2
9: HTTP/3
Want to learn more? Check out our courses