HTTP Response Status Codes

One of the key elements of a HTTP response is the HTTP status code, which informs the client (browser) about the status of its request.

This article is an overview of the most common HTTP status codes and their meanings.

A closeup pixilated screen showing a URL bar

1xx: Informational Codes

Informational status codes in the 1xx range indicate a provisional response requiring further action to complete the request.

  • 100 Continue: This code indicates that the server has received the request headers, and the client should continue to send the request body.
  • 101 Switching Protocols: This code is sent in response to a client's request to change the communication protocol.

2xx: Success Codes

The 2xx status codes indicate that the client's request was successfully received, understood, and accepted.

  • 200 OK: This is the standard response for successful HTTP requests.
  • 201 Created: The request has been fulfilled, and a new resource was created as a result.
  • 202 Accepted: The server has accepted the request but has not yet completed it.
  • 204 No Content: The server processed the request successfully but is not returning any content.
  • 206 Partial Content: The server is delivering only part of the resource due to a range header sent by the client.

3xx: Redirection Codes

3xx status codes indicate that the client must take additional action to complete the request, usually in the form of redirection.

  • 300 Multiple Choices: The client has several options it may follow.
  • 301 Moved Permanently: The requested resource has been moved to a new URL permanently.
  • 302 Found (Also known as Moved Temporarily): The requested resource is temporarily available under a different URL.
  • 304 Not Modified: The requested resource has not been modified since the last request.
  • 307 Temporary Redirect: The requested resource is temporarily available under a different URL, but future requests should still use the original URL.

4xx: Client Error Codes

4xx status codes are used when the client seems to have erred. They are intended to help the client correct the error for future requests.

  • 400 Bad Request: The server could not understand the request due to invalid syntax.
  • 401 Unauthorized: The request requires user authentication.
  • 403 Forbidden: The server understood the request but refuses to authorize it.
  • 404 Not Found: The server could not find the requested resource.
  • 405 Method Not Allowed: The method specified in the request is not allowed for the resource identified by request URI.
  • 408 Request Timeout: The server timed out waiting for the request.
  • 429 Too Many Requests: The user has sent too many requests in a given amount of time, also known as "rate limiting".

5xx: Server Error Codes

5xx status codes indicate cases in which the server is aware that it has encountered an error or is otherwise incapable of performing the request.

  • 500 Internal Server Error: An unexpected condition was encountered, and no more specific message is suitable.
  • 501 Not Implemented: The server lacks the ability to fulfill the request.
  • 502 Bad Gateway: The server acted as a gateway or proxy and received an invalid response from the upstream server.
  • 503 Service Unavailable: The server cannot handle the request due to temporary overloading or maintenance.
  • 504 Gateway Timeout: The server acted as a gateway or proxy and did not receive a timely response from the upstream server.

BONUS - 418: I'm a Teapot

The HTTP 418 I'm a teapot client error response code indicates that the server refuses to brew coffee because it is, permanently, a teapot.

The HTTP 418 "I'm a Teapot" status code is unique.

Maybe less unique and more hilarious.

It's not part of the standard HTTP status codes defined by any RFC, but it's still notable due to its origin.

This code was defined in the Hyper Text Coffee Pot Control Protocol (HTCPCP), which was an April Fools' Day joke in 1998 documented in RFC 2324.

While it's rarely used, it has been implemented on some websites and HTTP libraries as an Easter egg.

Tea Rex


Follow me on Twitter or connect on LinkedIn.

🚨 Want to make friends and learn from peers? You can join our free web developer community here. 🎉

BackendHttpApi
Avatar for Niall Maher

Written by Niall Maher

Founder of Codú - The web developer community! I've worked in nearly every corner of technology businesses; Lead Developer, Software Architect, Product Manager, CTO and now happily a Founder.

Loading

Fetching comments

Hey! 👋

Got something to say?

or to leave a comment.