Web Developmentbeginner10 min read

HTTP Status Codes Explained

A complete guide to HTTP response status codes. Learn what 200, 301, 404, 500, and other codes mean with real-world examples.

How Status Codes Work

Every HTTP response includes a three-digit status code that tells the client what happened. The first digit defines the class of response:

  • 1xx β€” Informational: the request is being processed
  • 2xx β€” Success: the request was received and accepted
  • 3xx β€” Redirection: further action is needed
  • 4xx β€” Client Error: the request has a problem
  • 5xx β€” Server Error: the server failed to fulfill a valid request

Success Codes (2xx)

  • 200 OK β€” Standard success response. The body contains the requested resource.
  • 201 Created β€” A new resource was created, typically after a POST request.
  • 204 No Content β€” Success with no response body, common for DELETE requests.
  • 206 Partial Content β€” The server is returning part of a resource, used for range requests (like resuming downloads).

Redirection Codes (3xx)

  • 301 Moved Permanently β€” The resource has a new permanent URL. Search engines transfer SEO value. Use for domain migrations.
  • 302 Found β€” Temporary redirect. The original URL should still be used for future requests.
  • 304 Not Modified β€” The cached version is still valid. Saves bandwidth by skipping the response body.
  • 307 Temporary Redirect β€” Like 302 but preserves the HTTP method (POST stays POST).

Client Error Codes (4xx)

  • 400 Bad Request β€” Malformed syntax, invalid parameters, or missing required fields.
  • 401 Unauthorized β€” Authentication is required. The client must provide credentials.
  • 403 Forbidden β€” The server understood the request but refuses to authorize it.
  • 404 Not Found β€” The requested resource does not exist.
  • 405 Method Not Allowed β€” The HTTP method (GET, POST, etc.) is not supported for this endpoint.
  • 409 Conflict β€” The request conflicts with the current state (e.g., duplicate resource).
  • 429 Too Many Requests β€” Rate limit exceeded. Check the Retry-After header.

Server Error Codes (5xx)

  • 500 Internal Server Error β€” A generic catch-all for unexpected server failures.
  • 502 Bad Gateway β€” The server acting as a proxy received an invalid response from upstream.
  • 503 Service Unavailable β€” The server is temporarily overloaded or under maintenance.
  • 504 Gateway Timeout β€” The proxy server did not receive a timely response from upstream.

Related Tutorials