Amina
Amina's Blog

lorem ipsum

Sep 25, 2024 3 minute read

HTTP Status Codes

Table of Contents

  1. What are HTTP Status Codes?
  2. The Structure of HTTP Status Codes
  3. List of HTTP Status Codes
  4. Useful Links

When you're browsing the web, a lot is happening behind the scenes. One of the essential components of this process is HTTP status codes. These codes are like short messages from the server that tell your browser what is happening with your request.

What are HTTP Status Codes?

HTTP status codes are part of the response a server sends back to a client's request. They are three-digit numbers that indicate whether a specific HTTP request has been successfully completed. For example, when you type a URL into your browser and hit enter, the server returns a status code to tell your browser if the request was successful, if there is an error, or if something else is happening.

The Structure of HTTP Status Codes

HTTP status codes are categorized into five classes, each serving a different purpose. Here's a quick overview:

  • 1xx: Informational Indicates that the request has been received and is being processed.
  • 2xx: Success Confirms that the request was successfully received, understood, and accepted.
  • 3xx: Redirection Informs the client that further action is needed to complete the request.
  • 4xx: Client Error Indicates an error caused by the client, such as a bad request or unauthorized access.
  • 5xx: Server Error Signals that the server failed to fulfill a valid request.

For example, let's use 403 Forbidden:

The first digit (4) indicates a client error, meaning the issue is caused by something from the user's side, like invalid credentials or improper access permissions. Specifically, 403 means that the server understands the request, but refuses to authorize it. This can happen when the user doesn't have the necessary permissions to access the requested resource.

Meanwhile, 401 Unauthorized also shows a client error. However, in this case, the second and third digits tell us that the server is requesting authentication and won’t proceed without valid login credentials.

List of HTTP Status Codes

Status Code Function
1XX — Informational
100 Continue
101 Switching Protocols
102 Processing
103 Early Hints
2XX — Success
200 OK
201 Created
202 Accepted
203 Non-Authoritative Information
204 No Content
205 Reset Content
206 Partial Content
207 Multi-Status
208 Already Reported
226 I'm Used
3XX — Redirection
300 Multiple Choices
301 Moved Permanently
302 Found
303 See Other
304 Not Modified
307 Temporary Redirect
308 Permanent Redirect
4XX — Client Error
400 Bad Request
401 Unauthorized
402 Payment Required
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Timeout
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Content Too Large
414 URI Too Long
415 Unsupported Media Type
416 Range Not Satisfiable
417 Expectation Failed
421 Misdirected Request
422 Unprocessable Content
423 Locked
424 Failed Dependency
425 Too Early
426 Upgrade Required
428 Precondition Required
429 Too Many Requests
431 Request Header Fields Too Large
451 Unavailable for Legal Reasons
5XX — Server Error
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported
506 Variant Also Negotiates
507 Insufficient Storage
508 Loop Detected
511 Network Authentication Required

Amina