Practical Guide

HTTP Status Codes — Usage Guide and Technical Principles

HTTP Status Codes Reference

Open tool

Overview

HTTP status codes communicate the result of web requests between clients and servers. Essential for web development, API design, and debugging network communications.

Key concepts

What are HTTP Status Codes

HTTP status codes are three-digit numbers returned by servers to indicate the outcome of an HTTP request. Defined by RFC 7231, they are grouped into five classes: 1xx (Informational), 2xx (Success), 3xx (Redirection), 4xx (Client Error), and 5xx (Server Error). Each code provides specific information about the request processing result.

Request-Response Mechanism

When a client sends an HTTP request to a server, the server processes it and returns a status code in the response header. The status line format is: HTTP/1.1 200 OK. The client application uses this code to determine next actions: retry on 5xx errors, follow redirects on 3xx codes, or handle authentication on 401/403.

Status Code Categories

1xx codes indicate ongoing processing (100 Continue, 101 Switching Protocols). 2xx codes confirm successful operations (200 OK, 201 Created, 204 No Content). 3xx codes require client redirection (301 Moved Permanently, 302 Found, 304 Not Modified). 4xx codes signal client-side errors (400 Bad Request, 401 Unauthorized, 404 Not Found). 5xx codes indicate server failures (500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable).

RESTful API Design

In RESTful API design, proper status code usage is critical. POST requests should return 201 for resource creation, PUT/PATCH return 200 or 204 for updates, DELETE returns 204 for successful deletion. Use 400 for validation errors, 401 for missing authentication, 403 for insufficient permissions, and 409 for conflicts. This standardization improves API usability and client-side error handling.

Key features

Complete Status Code Library

Comprehensive reference of all standard HTTP status codes from 1xx to 5xx, including detailed descriptions, meanings, and usage scenarios for each code

Smart Search & Filter

Quickly find status codes by number, name, or description. Filter by category (Informational, Success, Redirection, Client Error, Server Error) to locate relevant codes instantly

Category-Based Organization

Status codes organized by RFC 7231 standard categories with color-coded badges, making it easy to understand the nature of each response at a glance

Detailed Usage Guidance

Each status code includes practical examples, common use cases, and best practices for implementation in REST APIs and web applications

Use Cases

Web debugging

Use HTTP Status Codes to inspect browser, HTTP, API, storage, or configuration behavior while diagnosing frontend and backend integration issues.

Pre-release checks

HTTP Status Codes is useful before release when validating headers, browser data, URLs, CORS settings, API behavior, or client-side assumptions.

Support and handoff

Create reproducible examples with HTTP Status Codes for bug reports, support tickets, implementation guides, and team knowledge base articles.

Frequently Asked Questions

Why are HTTP status codes important for developers?

They are the contract between clients and servers. Correct codes let you decide whether to retry, prompt auth, follow redirects, or show user-friendly errors. Logging meaningful status codes also improves monitoring, SLO tracking, and API documentation.

What is the difference between 4xx and 5xx responses?

4xx means the client request is invalid or incomplete (400 bad syntax, 401 missing auth, 404 resource missing). 5xx means the server accepted the request but failed to process it (500 bug, 502 upstream error, 503 overload). Clients usually fix 4xx issues; server operators fix 5xx.

When should I use 301, 302, 307, or 308?

301/308 are permanent redirects (browsers cache them). 302/307 are temporary. 301/302 might change the HTTP method to GET, while 307/308 preserve the original method and body. Use 308 when you need a permanent redirect that keeps POST/PUT semantics.

How can I test status codes from the command line?

Use curl -I or httpie to inspect response headers: `curl -I https://api.example.com`. Add `-w "%{http_code}" -o /dev/null -s` to print only the status. You can also run `wget --spider --server-response URL` or use tools like Postman/Insomnia.

Can I define custom status codes?

Only numbers registered with IANA (100–599) are standardized. Some services use unofficial codes (e.g., 599 Network Connect Timeout), but clients may not understand them. Prefer standard codes and include error details in the response body instead of inventing new codes.

Related documentation

HTTP Status Codes

Open the tool to try these features.

Open tool