All 2xx Success 3xx Redirect 4xx Client Error 5xx Server Error

What are HTTP Status Codes?

HTTP status codes are three-digit numbers returned by a server in response to an HTTP request. They tell the client whether the request was successful, if it needs to take further action, or if an error occurred. Status codes are grouped into five classes based on their first digit.

HTTP Status Code Categories

  • 1xx (Informational): The request was received and the process is continuing.
  • 2xx (Success): The request was successfully received, understood, and accepted.
  • 3xx (Redirection): Further action needs to be taken by the client to complete the request.
  • 4xx (Client Error): The request contains bad syntax or cannot be fulfilled. The client made an error.
  • 5xx (Server Error): The server failed to fulfill an apparently valid request. The server made an error.

Most Common HTTP Status Codes

  • 200 OK: Standard success response for GET, PUT, PATCH, DELETE requests
  • 201 Created: Resource was successfully created, typically for POST requests
  • 301 Moved Permanently: The URL has permanently changed — used for SEO-friendly redirects
  • 400 Bad Request: The server cannot process the request due to invalid syntax
  • 401 Unauthorized: Authentication is required and has failed or was not provided
  • 403 Forbidden: The client doesn't have permission to access this resource
  • 404 Not Found: The requested resource could not be found on the server
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Unexpected server-side error

Frequently Asked Questions about HTTP Status Codes

What is the difference between HTTP 401 and 403?

HTTP 401 Unauthorized means authentication is required but missing or invalid — the user is not logged in or provided an expired token. HTTP 403 Forbidden means the user is authenticated but does not have permission to access the resource. In short: 401 means "who are you?", 403 means "I know who you are, but you cannot access this." Always send a WWW-Authenticate header with 401 to tell the client how to authenticate.

When should I use 201 Created instead of 200 OK?

Return 201 Created when a POST request successfully creates a new resource. Include a Location response header pointing to the URL of the newly created resource. Return 200 OK for successful GET, PUT, or PATCH requests that do not create new resources. For successful DELETE operations with an empty response body, return 204 No Content. Using the correct code helps API clients handle responses correctly.

What is HTTP 422 Unprocessable Entity?

HTTP 422 means the server understands the request content type and syntax is valid, but cannot process the semantic instructions. It is used in REST APIs when request body validation fails — a required field is missing, a value is out of range, or a date format is invalid. It is more specific than 400 Bad Request (which indicates malformed syntax). Return validation errors in the response body to help the client fix the request.

What is the difference between 500 and 503 status codes?

HTTP 500 Internal Server Error is a generic server-side error indicating something unexpected went wrong — a bug, an unhandled exception, or a misconfiguration. HTTP 503 Service Unavailable means the server is intentionally unable to handle the request right now, typically due to maintenance or being overloaded. With 503, include a Retry-After header to tell clients when to try again.

Related Developer Tools