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