Skip to main content

What classes of HTTP codes exist?

Classes of HTTP codes are groups of HTTP status codes defined by the code's first digit that show the general result of processing the request.

There are 5 classes of HTTP codes in total.


1xx, Informational

The request has been accepted, processing is still continuing.

Rarely used, mostly for service purposes.

Examples:

  • 100 Continue - it is fine to continue sending the request

An ordinary user almost never sees these.


2xx, Success

The request was completed successfully.

The most important and most frequently used codes.

Examples:

  • 200 OK - everything went fine
  • 201 Created - the resource was created
  • 204 No Content - success, but with no response body

If you see 2xx, everything is fine.


3xx, Redirection

The client needs to take an additional action, usually go to another address.

Examples:

  • 301 Moved Permanently - the resource has moved permanently
  • 302 Found - a temporary redirect
  • 304 Not Modified - the cache can be used

Often used by browsers automatically.


4xx, Client error

An error in the client's request: a wrong URL, no permissions, bad data.

The most familiar codes.

Examples:

  • 400 Bad Request - an invalid request
  • 401 Unauthorized - authorization is required
  • 403 Forbidden - access is denied
  • 404 Not Found - the resource was not found

Important for an interview: 4xx is not the server's problem, it's a problem with the request.


5xx, Server error

The server received a correct request but could not process it.

Examples:

  • 500 Internal Server Error - an internal server error
  • 502 Bad Gateway - an error while working with another server
  • 503 Service Unavailable - the service is temporarily unavailable

This is already a problem on the server's side.


A short table to remember

ClassMeaning
1xxInformation
2xxSuccess
3xxRedirection
4xxClient error
5xxServer error

Short answer for an interview

Remember this wording:

There are 5 classes of HTTP codes: 1xx are informational, 2xx are successful, 3xx are redirections, 4xx are client errors, and 5xx are server errors.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.