When a client (like a browser or API tool) sends a request to a server, the server responds with a status code. This code tells you:
π βWhat happened to your request?β
What is an HTTP Status Code?
An HTTP status code is a 3-digit number returned by the server to indicate the result of a request.
1. 200 OK β Success β
200 means the request was successful.
When you see 200:
- Data fetched successfully
- Request processed correctly
Example:
```http id="s1"
GET /users/101 β 200 OK
π User data returned successfully
---
## 2. 404 Not Found β Resource Missing β
**404** means the requested resource was **not found on the server**.
### When you see 404:
* Wrong URL
* Resource doesnβt exist
* Invalid ID
### Example:
```http id="s2"
GET /users/999 β 404 Not Found
π User doesnβt exist
3. 500 Internal Server Error β Server Issue β οΈ
500 means something went wrong on the server side.
When you see 500:
- Code error (NullPointerException, etc.)
- Server crash
- Unexpected failure
Example:
```http id="s3"
POST /users β 500 Internal Server Error
π Server failed to process request
---
## Quick Comparison
| Status Code | Meaning | Type | Example Scenario |
| ----------- | ------------ | --------------- | ------------------------- |
| 200 | Success | β
Success | Data fetched successfully |
| 404 | Not Found | β Client Error | Invalid URL/resource |
| 500 | Server Error | β οΈ Server Error | Bug in backend |
---
## Status Code Categories
All HTTP status codes fall into 5 groups:
| Range | Category | Meaning |
| ----- | ------------- | --------------------- |
| 1xx | Informational | Request received |
| 2xx | Success | Request successful |
| 3xx | Redirection | Further action needed |
| 4xx | Client Errors | Problem with request |
| 5xx | Server Errors | Problem on server |
---
## Real-Time Example
Imagine using a website:
* Page loads β **200 OK** β
* Page not found β **404 Error** β
* Site crashes β **500 Error** β οΈ
---
## Why Status Codes Matter
* Help debug issues quickly
* Improve API design
* Provide clear communication between client & server
* Essential for frontend-backend interaction
---
## Conclusion
HTTP status codes are a critical part of web communication. Understanding codes like **200, 404, and 500** helps developers build and debug applications effectively.
---
## Learn More
Want to master REST APIs, Spring Boot, and backend development?
π **[No 1 Core JAVA Online Training in 2026](https://ashokitech.com/core-java-online-training/)**
---
Top comments (0)