http status codes for beginners

Think of status codes as responses from the server telling you what happened when you made a request (opened a website, called an API, etc.).
📦 Status Code Groups (Easy Rule)
Status codes are grouped by their first digit:
| Range | Meaning (In simple words) |
| 1xx | “Got it, wait a bit” |
| 2xx | “Everything went well” ✅ |
| 3xx | “Go somewhere else” 🔁 |
| 4xx | “You (client) made a mistake” ❌ |
| 5xx | “Server messed up” 💥 |
🟡 1xx – Informational (Rarely used)
👉 Server says: “I received your request, processing…”
Example:
100 ContinueYou’ll almost never handle these directly as a beginner.
📌 Ignore for now
🟢 2xx – Success
👉 Server says: “All good 👍”
Common ones:
200 OK
✅ Request successful
Example: Page loaded, API returned data201 Created
✅ Something new was created
Example: User registered, blog post created204 No Content
✅ Success but nothing to return
Example: Delete API succeeded
🧠 Rule:
If you see 2xx → your request worked
🔵 3xx – Redirection
👉 Server says: “You’re in the wrong place, go here instead”
Common ones:
301 Moved Permanently
Example:http → https302 Found / Temporary Redirect
Example: Redirecting to login page
🧠 Rule:
Server is not giving data, it’s redirecting you
🔴 4xx – Client (Your) Mistake
👉 Server says: “I’m fine, but YOU did something wrong”
This matches your example perfectly 👇
Common ones:
400 Bad Request
❌ You sent wrong data / malformed request
Example:Missing required fields
Wrong JSON format
🧠 Server exists, API exists, but input is wrong
401 Unauthorized
❌ You are not logged in
Example: Missing token403 Forbidden
❌ You are logged in, but not allowed
Example: Trying to access admin data404 Not Found
❌ URL or resource does not exist
Example: Wrong API route
🧠 Rule:
If 4xx → check URL, headers, body, auth
🔥 5xx – Server Mistake
👉 Server says: “Your request was fine, but I crashed”
Common ones:
500 Internal Server Error
💥 Something broke in backend code
Example:Null pointer
DB query failed
502 Bad Gateway
💥 One server got a bad response from another server503 Service Unavailable
💥 Server is down or overloaded
🧠 Rule:
If 5xx → backend issue, not your fault
🧠 Super Simple Memory Trick
2xx → Success
3xx → Redirect
4xx → Your mistake
5xx → Server mistake
Better version 👇
✅ 400 → Server exists, API exists, but request data is wrong
✅ 404 → Server exists, but URL is wrong
💡 Real-life Analogy (Restaurant 🍽️)
200 → You got your food
400 → You ordered nonsense
401 → You didn’t pay
403 → You’re not allowed inside
404 → That dish doesn’t exist
500 → Kitchen caught fire 🔥
