MainContent
p-top: 48 p-bot: 48 p-left: 32 p-right: 32 p-x: 32 m-bot: 24

HTTP Status Codes Guide: Complete Reference for Web Developers

Complete guide to HTTP status codes including 1xx, 2xx, 3xx, 4xx, and 5xx responses. Learn what each status code means, when to use them, and how to handle them in your applications.

Try Our URL Parser Parse and analyze URLs for your HTTP requests with our free online tool

Introduction to HTTP Status Codes

HTTP status codes are three-digit numbers returned by servers to indicate the result of a client's request. Understanding these codes is essential for web development, API design, debugging, and building robust applications.

What are HTTP Status Codes?

HTTP status codes are standardized responses that indicate whether a specific HTTP request has been successfully completed. They are grouped into five classes based on the first digit.

Status Codes in HTTP Responses

Status codes are returned in the first line of an HTTP response, along with the protocol version and a reason phrase.

1xx Informational Responses

Informational responses indicate that the request was received and understood, and the server is continuing to process it. These are interim responses.

100 Continue

The server has received the request headers and the client should proceed to send the request body. Used with the Expect: 100-continue header.

101 Switching Protocols

The server is switching protocols as requested by the client. Commonly used when upgrading to WebSocket.

102 Processing

The server has received and is processing the request, but no response is available yet. Used to prevent client timeout.

2xx Successful Responses

Success codes indicate that the client's request was successfully received, understood, and accepted by the server.

200 OK

The request succeeded. The meaning depends on the HTTP method: GET (resource fetched), POST (resource created), PUT (resource updated).

201 Created

The request succeeded and a new resource was created. Typically returned from POST requests. Should include a Location header pointing to the new resource.

202 Accepted

The request has been accepted for processing, but processing has not been completed. Used for async operations.

204 No Content

The request succeeded but there is no content to return. Common for DELETE requests or updates that don't return data.

206 Partial Content

The server is delivering only part of the resource due to a range request from the client. Used for resumable downloads and video streaming.

3xx Redirection Messages

Redirection codes indicate that further action is needed to complete the request. The client typically needs to make another request to a different URL.

301 Moved Permanently

The resource has been permanently moved to a new URL. All future requests should use the new URL. Search engines update their indexes.

302 Found (Temporary Redirect)

The resource is temporarily located at a different URL. The client should continue using the original URL for future requests.

304 Not Modified

The resource has not been modified since the last request. The client can use its cached version. Used with conditional requests.

307 Temporary Redirect & 308 Permanent Redirect

307 and 308 are similar to 302 and 301, but guarantee that the HTTP method will not change during redirection.

4xx Client Error Responses

Client error codes indicate that the request contains bad syntax or cannot be fulfilled. The client should not repeat the request without modification.

400 Bad Request

The server cannot process the request due to client error (e.g., malformed syntax, invalid parameters).

401 Unauthorized

Authentication is required and has failed or not been provided. The client must authenticate itself to get the requested response.

403 Forbidden

The server understands the request but refuses to authorize it. Unlike 401, authenticating will make no difference.

404 Not Found

The server cannot find the requested resource. This is one of the most common status codes.

405 Method Not Allowed

The HTTP method is not allowed for the requested resource. The response should include an Allow header listing allowed methods.

409 Conflict

The request conflicts with the current state of the server. Common in duplicate resource creation or version conflicts.

422 Unprocessable Entity

The server understands the content type and syntax is correct, but was unable to process the contained instructions (semantic errors).

429 Too Many Requests

The user has sent too many requests in a given amount of time (rate limiting).

5xx Server Error Responses

Server error codes indicate that the server failed to fulfill a valid request. These errors suggest a problem with the server, not the client.

500 Internal Server Error

A generic error message when the server encounters an unexpected condition. The most common server error.

502 Bad Gateway

The server, while acting as a gateway or proxy, received an invalid response from an upstream server.

503 Service Unavailable

The server is temporarily unable to handle the request. Common during maintenance or when the server is overloaded.

504 Gateway Timeout

The server, acting as a gateway or proxy, did not receive a timely response from an upstream server.

Best Practices for Using HTTP Status Codes

Learn best practices for choosing and implementing HTTP status codes in your APIs and web applications.

Choosing the Right Status Code

Select appropriate status codes based on the actual outcome of the request.

Providing Helpful Error Messages

Include descriptive error messages and additional context to help clients understand and fix issues.

Consistent Error Response Format

Maintain a consistent error response structure across your entire API.
Advertisement 300x250
📢
Your Ad Here
Square ad space for Blog articles and tutorials
Blog