What Are HTTP Status Codes?
HTTP status codes are three-digit responses returned by a web server to describe the result of a client's request. They are a fundamental part of the Hypertext Transfer Protocol (HTTP), allowing browsers, applications, APIs, and other systems to understand what happened after a request was processed.
Every time a user visits a website, calls an API, downloads a file, or submits data, an HTTP request is sent to a server. The server responds with a status code that indicates whether the request was successful, redirected, failed, or requires further action.
For example, when loading a webpage:
GET /dashboard HTTP/1.1
HTTP/1.1 200 OKThe 200 OK response tells the client that the request was successfully completed.
Why Do HTTP Status Codes Exist?
Computers need a standard way to communicate the outcome of requests. Without status codes, every application would need its own method of reporting errors and success states.
HTTP status codes provide a universal language between clients and servers.
For example:
200 OK
The request succeeded.
404 Not Found
The requested resource does not exist.
500 Internal Server Error
The server encountered a problem.The HTTP Status Code Categories
HTTP status codes are grouped into five categories. The first digit identifies the type of response.
1xx - Informational:The request has been received and processing is continuing.
2xx - Success:The request was successfully received and completed.
3xx - Redirection:The client needs to perform another action, usually requesting another URL.
4xx - Client Errors:The request contains an error from the client side.
5xx - Server Errors:The server failed while attempting to complete a valid request.
Successful HTTP Responses (2xx)
200 OK
The 200 OK response indicates that a request was successfully processed.
It is the most common HTTP response returned by websites and APIs.
GET /users/25
HTTP/1.1 200 OK201 Created
The 201 Created response indicates that a new resource has been successfully created.
It is commonly used when creating data through an API.
POST /api/users
HTTP/1.1 201 Created204 No Content
The 204 No Content response means the request succeeded but there is no data to return.
This is often used after successful delete operations.
Redirection Responses (3xx)
301 Moved Permanently
A 301 response tells clients and search engines that a resource has permanently moved to a new location.
Common uses include:
Changing domain names
Updating URL structures
Redirecting old pages
304 Not Modified
A 304 Not Modified response allows clients to use a cached version of a resource instead of downloading
it again.
This improves performance by reducing unnecessary network requests.
Client Error Responses (4xx)
400 Bad Request
The server cannot process the request because the client sent invalid data or incorrect syntax.
Common causes include:
Invalid JSON payloads
Missing required parameters
Incorrect request formatting
401 Unauthorized
The 401 Unauthorized response indicates that authentication is required.
Example:
GET /api/admin
HTTP/1.1 401 Unauthorized403 Forbidden
A 403 Forbidden response means the server understands the request but refuses to allow access.
The user may be authenticated but does not have the required permissions.
404 Not Found
The 404 Not Found response occurs when the requested resource cannot be found.
Common causes include:
A deleted page
A broken URL
An incorrect API endpoint
429 Too Many Requests
The 429 Too Many Requests response indicates that a client has exceeded a rate limit.
This is commonly used by APIs to prevent abuse and protect resources.
Server Error Responses (5xx)
500 Internal Server Error
A 500 Internal Server Error indicates that the server encountered an unexpected problem.
Possible causes include:
Application crashes
Database failures
Unhandled exceptions
502 Bad Gateway
A 502 Bad Gateway response occurs when a server acting as a gateway receives an invalid response from
another server.
This is common in architectures involving:
Nginx reverse proxies
Load balancers
Microservices
503 Service Unavailable
A 503 Service Unavailable response indicates that a service is temporarily unable to handle requests.
Common causes include:
Maintenance windows
Server overload
Failed deployments
HTTP Status Codes In DevOps
HTTP status codes are extremely important in DevOps because they provide visibility into how applications and infrastructure are behaving.
They are commonly monitored through:
Application performance monitoring tools
Load balancers
Reverse proxies
API gateways
CI/CD health checks
For example, a sudden increase in 500 responses after a deployment may indicate an application failure,
while increased 404 responses may indicate broken routes or incorrect configuration.
Testing HTTP Status Codes
Developers and system administrators often use command-line tools such as curl to inspect HTTP responses.
curl -I https://example.comExample output:
HTTP/2 200
content-type: text/htmlConclusion
HTTP status codes provide a simple but powerful way for systems to communicate the result of a request. Understanding them is essential for developers, system administrators, and DevOps engineers.
From debugging failed deployments to monitoring production services, HTTP status codes are one of the most useful tools for understanding how modern web infrastructure behaves.