Back Reference

HTTP Status Codes Reference — Complete 1xx to 5xx List

Complete list of HTTP response status codes with descriptions, use cases, and real-world examples. Search by code number or keyword to find what you need for API development, debugging, and server configuration. Aligned with RFC 9110 (HTTP Semantics, 2022) — the current authoritative HTTP standard.

Last updated: April 2026

What are HTTP status codes?

HTTP status codes are three-digit numerical responses servers send to clients to communicate the outcome of an HTTP request. They are the universal language of the web: 200 OK means success, 404 Not Found means the resource doesn't exist, 500 Internal Server Error means something broke server-side. The current authoritative spec is RFC 9110 ("HTTP Semantics", 2022), which consolidates and supersedes RFC 2616, RFC 7230–7235, and several others.

Status codes split into five families based on the first digit:

ClassRangeMeaningAction by client
1xx Informational100–199Provisional response — request received, processingWait for final response
2xx Success200–299Request succeededRender / consume response
3xx Redirection300–399Further action needed (usually a different URL)Follow the redirect
4xx Client error400–499Client sent something invalid or unauthorizedFix the request, do not retry blindly
5xx Server error500–599Server failed to fulfill a valid requestRetry with backoff; the server is at fault

Why this matters: every layer of the modern web — browsers, CDNs, proxies, load balancers, monitoring systems, search engines — relies on status codes to make decisions. Send the wrong code and Google deindexes you, Cloudflare caches errors, retries hammer your servers, and users see broken UI.

The 12 most important HTTP status codes you'll actually use

CodeNameUse when
200OKSuccessful GET, successful PUT/PATCH that updated
201CreatedSuccessful POST that created a resource. Include Location: header.
204No ContentSuccessful DELETE, or successful PUT with no body to return
301Moved PermanentlyURL changed forever. Search engines transfer SEO equity. Update bookmarks.
302 / 307Found / Temporary RedirectTemporary redirect. SEO equity stays on the original URL.
304Not ModifiedConditional GET — client's cache is still valid. No body.
400Bad RequestMalformed JSON, missing required field, type mismatch
401UnauthorizedMissing or expired authentication. The user has NOT proven who they are.
403ForbiddenAuthenticated, but lacks permission for this resource
404Not FoundResource doesn't exist. Most-recognized error code in the world.
409ConflictState conflict — duplicate slug, version mismatch, simultaneous edit
422Unprocessable EntitySyntactically valid request but semantically invalid (validation failed)
429Too Many RequestsRate-limited. Include Retry-After: header.
500Internal Server ErrorUnhandled exception. Don't leak stack traces to users.
502Bad GatewayUpstream service (the API your server proxies to) failed
503Service UnavailableServer is overloaded or down for maintenance
504Gateway TimeoutUpstream service didn't respond in time

301 vs 302 vs 307 vs 308 — the redirect maze

Four codes cover redirects. Picking the wrong one breaks SEO, breaks form re-submission, or both.

CodePermanent?Method preserved?SEO transfers?When to use
301 Moved PermanentlyYesBrowsers may change POST → GET (legacy)Yes — > 99% in 2026Permanent URL changes (site migrations, slug changes)
302 FoundNoBrowsers may change POST → GET (legacy)NoTemporary redirect, A/B tests, geo-routing
307 Temporary RedirectNoYes — POST stays POSTNoModern temporary redirect when you need to preserve method/body
308 Permanent RedirectYesYes — POST stays POSTYesModern permanent redirect when method preservation matters

The "POST → GET" gotcha (301/302 only)

Historically, browsers were inconsistent about whether to change a POST to a GET when following a 301 or 302. Most modern browsers preserve the method, but some legacy tools don't. Use 307/308 if method preservation matters. For plain URL redirects (which are the common case), 301 is still the right answer in 2026 — Google fully understands it transfers SEO equity, and ~all browsers handle it correctly.

SEO rule: if a URL change is permanent, use 301. Period. 302 is for A/B tests, geo-redirects, or maintenance — not for "I changed my mind about the URL." Wrong choice fragments your link equity.

401 vs 403 — Unauthorized vs Forbidden

Confused constantly. They mean different things:

401 Unauthorized — "Who are you?"

The client has NOT successfully authenticated. Either the credentials are missing entirely or invalid. The expected client behavior: prompt for login, retry with credentials.

  • Missing Authorization header
  • Expired JWT
  • Invalid API key
  • Wrong username/password

The response should include a WWW-Authenticate header indicating the auth scheme (Bearer, Basic, etc.).

403 Forbidden — "I know who you are, you can't do this"

The client IS authenticated but lacks permission. No amount of re-authentication will help — they need different permissions.

  • Read-only API key trying to POST
  • Free-tier user accessing premium endpoint
  • Admin route accessed by non-admin user
  • IP-based geo-blocking ("Sorry, not available in your region")

Mnemonic: 401 = "Authenticate yourself." 403 = "Authentication accepted; access still denied."

200 vs 201 vs 204 — the success codes

For REST APIs, picking the right success code communicates intent:

CodeHTTP methodBodyExample
200 OKGET, PUT, PATCHThe current state of the resourceGET /users/42 → user JSON
201 CreatedPOSTThe new resource (or just Location:)POST /users → 201 + Location: /users/43
202 AcceptedPOST/PUT (async)Job ID or status URLPOST /reports/generate → 202 (job queued)
204 No ContentDELETE, PUT (no body)EmptyDELETE /users/42 → 204
206 Partial ContentGET with RangeRequested byte rangeVideo streaming, resumable downloads

4xx vs 5xx in practice — who do you blame?

4xx codes blame the client

"You did something wrong." 4xx codes should NOT be retried automatically — retrying with the same input gets the same error. The client must change the request. Common 4xx in monitoring dashboards:

  • 400 — malformed JSON, validation failed
  • 401 — token expired (very common — auto-refresh tokens to handle gracefully)
  • 403 — permission denied
  • 404 — typo in URL, deleted resource, dynamic 404 from your CMS
  • 410 Gone — explicitly deleted, will never come back. Stronger than 404 for SEO removal.
  • 422 — semantic validation (email format, password too short, age out of range)
  • 429 — rate-limited; client must back off

5xx codes blame the server

"I tried, I failed." 5xx codes ARE typically retryable — with backoff. Most production monitors page on-call when 5xx rate exceeds 0.5%.

  • 500 — unhandled exception in your code (log + fix)
  • 502 Bad Gateway — your nginx couldn't reach your app server (app crashed?)
  • 503 Service Unavailable — overloaded; database down; deploying. Include Retry-After.
  • 504 Gateway Timeout — upstream took too long. Increase timeout or speed up upstream.

The hidden case: returning 200 with an error in the body

Common anti-pattern: 200 OK with { "error": "User not found" }. Why it's bad:

  • Monitoring tools think everything is fine; alerts don't fire
  • Cloudflare and CDN cache the error response
  • Retry logic doesn't trigger (clients only retry on 5xx)
  • Browser DevTools shows green status; users debugging are confused

Fix: use the right status. 404 for "not found", 400 for "invalid input", 500 for "I broke." The response body can also contain detail — but the status comes first.

Status codes for SEO — what Google really cares about

CodeGoogle's interpretationLong-term effect
200Page exists, may be indexedIndexed if content is good
301Permanent move; transfer all signals to new URLOld URL drops, new URL inherits backlinks & rankings
302/307Temporary; keep original in indexOriginal URL stays indexed; new URL doesn't accumulate signals
404Doesn't exist (yet); will retry crawlingEventually drops from index after weeks of consistent 404
410 GoneDefinitively gone; deindex faster than 404Drops from index in days, not weeks
500/503Temporary issue; retry laterWon't deindex unless persistent for weeks
429Slow down crawlingReduced crawl rate for a few days

Common SEO mistakes around status codes:

  • "Soft 404" — returning 200 OK with a "Sorry, not found" page. Google recognizes the pattern as a 404 anyway and penalizes the trick.
  • 302-redirecting permanent moves — fragments link equity. Use 301.
  • Returning 503 for too long during deploys — Google's crawler cuts crawl rate. Aim for sub-minute deploys.
  • Returning 410 instead of 404 for deleted content — actually a positive in some cases. Use 410 when you've deliberately removed content forever (deleted blog post, removed product).

Returning HTTP status codes in 8 frameworks

Express (Node.js)

express
app.get('/users/:id', async (req, res) => {
  const user = await db.user.findById(req.params.id);
  if (!user) return res.status(404).json({ error: 'User not found' });
  res.status(200).json(user);
});

app.post('/users', async (req, res) => {
  const u = await db.user.create(req.body);
  res.status(201).location(`/users/${u.id}`).json(u);
});

FastAPI (Python)

fastapi
from fastapi import FastAPI, HTTPException, status

@app.get("/users/{id}", status_code=status.HTTP_200_OK)
def get_user(id: int):
    user = db.find_user(id)
    if not user:
        raise HTTPException(status_code=404, detail="User not found")
    return user

@app.post("/users", status_code=status.HTTP_201_CREATED)
def create_user(user: UserIn):
    return db.create_user(user)

Spring Boot (Java)

spring-boot
@GetMapping("/users/{id}")
public ResponseEntity<User> getUser(@PathVariable Long id) {
    return userRepo.findById(id)
        .map(ResponseEntity::ok)
        .orElse(ResponseEntity.notFound().build());
}

@PostMapping("/users")
public ResponseEntity<User> createUser(@RequestBody User u) {
    User saved = userRepo.save(u);
    return ResponseEntity.created(URI.create("/users/" + saved.getId())).body(saved);
}

Rails (Ruby)

rails
def show
  user = User.find_by(id: params[:id])
  return render(json: { error: 'Not found' }, status: :not_found) unless user
  render json: user, status: :ok
end

def create
  user = User.create!(user_params)
  render json: user, status: :created, location: user_url(user)
end

Go (net/http)

go
func userHandler(w http.ResponseWriter, r *http.Request) {
    user, err := db.GetUser(r.URL.Path[7:])
    if err != nil {
        http.Error(w, "User not found", http.StatusNotFound)
        return
    }
    w.WriteHeader(http.StatusOK)
    json.NewEncoder(w).Encode(user)
}

Laravel (PHP)

laravel
public function show($id) {
    $user = User::find($id);
    if (!$user) return response()->json(['error' => 'Not found'], 404);
    return response()->json($user, 200);
}

public function store(Request $request) {
    $user = User::create($request->validated());
    return response()->json($user, 201)
        ->header('Location', "/users/{$user->id}");
}

Cloudflare Workers / Edge runtimes

workers
export default {
  async fetch(req, env) {
    const u = await env.DB.get(extractId(req));
    if (!u) return new Response('Not found', { status: 404 });
    return new Response(JSON.stringify(u), {
      status: 200,
      headers: { 'content-type': 'application/json' },
    });
  },
};

Bash / curl (testing)

bash
# Show only the status code (great for monitoring scripts)
curl -s -o /dev/null -w '%{http_code}\n' https://example.com

# Show full headers
curl -I https://example.com

# Follow redirects and report all hops
curl -ILs https://example.com

# Fail bash script if status is not 2xx
curl --fail-with-body https://example.com/api

Status code best practices

  • Use the most specific code. 422 for validation errors beats 400 for everything. 410 for permanently-deleted content beats 404. Specificity helps clients build better error handling.
  • Never return 200 with an error. Status codes are how every layer of the stack makes decisions. Lying about success breaks monitoring, retries, caching.
  • Add Retry-After on 429 and 503. Tells clients exactly how long to wait. Servers and CDNs (Cloudflare) honor it automatically.
  • Don't leak stack traces in 500 responses. Generic "Internal Server Error" + log the real details server-side. Stack traces in production are a security hole.
  • Use 301 for permanent URL changes; 302 for temporary. Confusing them fragments SEO equity.
  • Return a structured error body with the status code: { "error": { "code": "USER_NOT_FOUND", "message": "...", "details": {} } }. Lets clients programmatically handle specific errors.
  • Set proper headers alongside status codes. Location: on 201/3xx, WWW-Authenticate: on 401, Retry-After: on 429/503, Allow: on 405.
  • Use 405 Method Not Allowed for "this endpoint exists, but you can't POST to it." Include Allow: GET, PUT in response.
  • Distinguish 401 (auth) from 403 (permissions). Critical for client retry logic — 401 prompts re-login, 403 doesn't.
  • Don't use 200 for "delete succeeded". Use 204 No Content. Saves bandwidth, signals intent.

Best HTTP status code reference for 2026 — what to compare

Search results for "http status codes", "http response codes", "404 meaning" return many references but most are outdated (citing RFC 7231 instead of the current RFC 9110, finalized 2022), missing the newer codes (103 Early Hints widely deployed, 451 Unavailable For Legal Reasons), or don't differentiate the redirect codes 301 vs 302 vs 307 vs 308 — a distinction that breaks POST handlers. Here's how the most-used HTTP status references compare in 2026:

ReferenceLatest RFC (9110)Includes 103 Early HintsSearchableCost
FreeDevTool HTTP Status CodesYesYesLive filterFree
MDN HTTP Status CodesYesYesBrowse + Ctrl+FFree, OSS
httpstatuses.comPartialYesURL-basedFree
http.cat / http.dogN/A (memes)YesNoFree
RFC 9110 (raw)Source of truthYesNo (PDF)Free

What's the difference between 301, 302, 307, and 308 redirects?

Four redirect codes that look similar but behave differently — and getting them wrong breaks POST flows in production:

CodePermanenceMethod preservationUse case
301 Moved PermanentlyPermanent❌ Browser may switch POST→GETOld URL → new canonical URL (SEO transfers link equity)
302 FoundTemporary❌ Browser may switch POST→GETTemporary redirect (A/B test, maintenance page)
307 Temporary RedirectTemporary✅ MUST preserve method + bodyTemporary, when method preservation matters (POST after deploy)
308 Permanent RedirectPermanent✅ MUST preserve method + bodyModern equivalent of 301 — preserves POST

Critical 2026 rule: use 308 instead of 301 for permanent redirects unless you specifically want browser-quirk behavior (very rare). Cloudflare Pages auto-redirects .html → extensionless with 308 for this reason. The 301/302 method-switching behavior is a 1990s legacy quirk that breaks REST APIs.

What's the difference between 401 Unauthorized and 403 Forbidden?

The two codes overlap visually but mean different things. 401 Unauthorized means "I don't know who you are" — credentials missing, expired, or invalid. The response MUST include a WWW-Authenticate header indicating how to authenticate. Client should retry with credentials. 403 Forbidden means "I know who you are, but you can't do this" — credentials are valid but the user lacks permission for this resource. Client should NOT retry with the same credentials; they need different credentials or an admin to grant access. Mistake to avoid: returning 404 Not Found on a forbidden private resource to hide its existence is acceptable for security; returning 401 when you mean 403 sends clients into a credential-refresh loop that won't work.

HTTP status code reference alternative to httpstatuses.com — 4 reasons developers switched

  1. Live search across all codes. Type "404", "redirect", or "not found" — results filter instantly. httpstatuses.com requires URL navigation to each code page.
  2. Modern (RFC 9110, 2022) accuracy. Includes 103 Early Hints (now widely deployed for Largest Contentful Paint optimization), 421 Misdirected Request, 451 Unavailable For Legal Reasons.
  3. Method-preservation table for redirects. The 301 vs 308 distinction is critical for REST APIs but missing or buried in most references.
  4. Examples in 8 frameworks. Express, FastAPI, Django, Rails, Spring Boot, Go net/http, ASP.NET Core, Laravel — copy-ready code snippets for returning each code idiomatically.

Pair the HTTP status reference with the HTTP Request Builder for testing requests against your API, the DNS Lookup for resolving domains before request, the JWT Decoder for inspecting auth tokens that produce 401/403, and the Network & Time Tools hub for the broader networking toolkit.

Frequently Asked Questions

What are HTTP status codes and why are they important?
HTTP status codes are three-digit numbers returned by a web server in response to a client's request, standardized in RFC 7231 and related RFCs. They are grouped into five categories: 1xx (informational), 2xx (success), 3xx (redirection), 4xx (client error), and 5xx (server error). Understanding these codes is essential for API development, web server configuration, frontend error handling, SEO optimization, and debugging network issues.
What is the difference between 301 and 302 redirects?
A 301 Moved Permanently tells browsers and search engines the resource has permanently moved. Search engines transfer link equity (SEO ranking) to the new URL and update their index. A 302 Found indicates a temporary redirect — the original URL remains in search indexes. Using 301 when you mean 302 (or vice versa) can negatively impact your search rankings and user experience.
Which HTTP status codes should I use in my REST API?
Common REST API codes: 200 OK (successful GET/PUT), 201 Created (successful POST), 204 No Content (successful DELETE), 400 Bad Request (malformed input), 401 Unauthorized (missing authentication), 403 Forbidden (insufficient permissions), 404 Not Found, 409 Conflict (duplicate resource), 422 Unprocessable Entity (validation failure), and 500 Internal Server Error for unexpected failures.

Browse all 50 free developer tools

All tools run in your browser, no signup required, nothing sent to a server.