Every time your browser loads a page, downloads an image, or submits a form, the web server sends back an HTTP status code. That short number tells you whether the request worked, needs a redirect, or failed — and on whose side the problem lies (client or server).
This guide lists the main status codes grouped by class (1xx through 5xx), explains what each one means, and shows how to read codes with fetch() in plain JavaScript Try It demos.
What You’ll Learn
01
What they are
3-digit codes.
02
Five classes
1xx to 5xx.
03
200 OK
Success.
04
301 / 302
Redirects.
05
404 / 403
Client errors.
06
500 / 503
Server errors.
Fundamentals
What is HTTP Status Code?
HTTP status codes are three-digit numeric codes that are returned by a web server in response to an HTTP request made by a client (such as a web browser).
These status codes provide information about the status of the request and the outcome of the server’s attempt to fulfill it.
The HTTP status codes are grouped into different classes, each indicating a specific category of response.
The classes are defined by the first digit of the status code:
Class
Range
Meaning
1xx
100–199
Informational — request received, still processing
2xx
200–299
Success — request completed as expected
3xx
300–399
Redirection — client must take further action
4xx
400–499
Client error — problem with the request
5xx
500–599
Server error — server failed to fulfill a valid request
💡
Beginner Tip
In JavaScript, after fetch(url), use response.status to read the numeric code and response.ok (true for 200–299) for a quick success check.
1xx
1xx — Informational
The request has been received and the server is continuing the process.
Status Code
Message
Explanation
100
Continue
Used to indicate to the client that it can proceed with sending the remainder of the request.
101
Switching Protocols
Used to indicate that the server is switching protocols as requested by the client.
102
Processing
Used to indicate that the server has received and is processing the request, but it has not yet completed the process.
103
Early Hints
Used to provide the client with some hints or headers before sending the final response. (Formerly called Checkpoint in older drafts.)
2xx
2xx — Success
The request was successfully received, understood, and processed by the server.
Status Code
Message
Explanation
200
OK
Used to indicate that the client’s request has been successfully received, understood, and processed by the server.
201
Created
Used to indicate that a new resource has been successfully created as a result of a client’s request.
202
Accepted
Used to indicate that the client’s request has been accepted for processing, but the processing is not yet complete.
203
Non-Authoritative Information
Used to indicate that the server is providing a representation of the requested resource that may be from a third-party or non-origin server.
204
No Content
Used to indicate that the server has successfully processed the client’s request, but there is no content to be returned in the response.
205
Reset Content
Used to instruct the client to reset the current document and clear any form fields or input values.
206
Partial Content
Used to indicate that the server has successfully fulfilled a partial GET request from the client.
3xx
3xx — Redirection
The client needs to take additional action to complete the request.
Status Code
Message
Explanation
300
Multiple Choices
Used to indicate that the requested resource has multiple choices available, and the client should choose one of them to proceed.
301
Moved Permanently
Used to indicate that the requested resource has been permanently moved to a new location.
302
Found
Used to indicate that the requested resource has been temporarily moved to a different location.
303
See Other
Used to indicate that the client should retrieve the requested resource from a different location using a GET request.
304
Not Modified
Used to indicate that the requested resource has not been modified since the client’s last request, and the client can use its cached version of the resource.
306
(Unused)
Reserved; no longer used. Listed in some references for historical completeness.
307
Temporary Redirect
Used to indicate that the requested resource has been temporarily moved to a different location.
308
Permanent Redirect
Used to indicate that the requested resource has been permanently moved to a different location.
4xx
4xx — Client Error
The request contains incorrect syntax or cannot be fulfilled by the server due to client error.
Status Code
Message
Explanation
400
Bad Request
Used to indicate that the server cannot process the client’s request due to malformed syntax or other client-side errors.
401
Unauthorized
Used to indicate that the client’s request lacks valid authentication credentials for the requested resource.
402
Payment Required
Used to indicate that payment is required to access the requested resource.
403
Forbidden
Used to indicate that the client’s request is understood by the server, but the server refuses to fulfill it.
404
Not Found
Used to indicate that the server cannot find the requested resource.
405
Method Not Allowed
Used to indicate that the requested HTTP method is not allowed for the given resource.
406
Not Acceptable
Used to indicate that the server cannot generate a response that satisfies the client’s requested content requirements.
407
Proxy Authentication Required
Used to indicate that the client must authenticate itself with a proxy server before making the requested request. It is part of the HTTP 4xx status code class.
408
Request Timeout
Used to indicate that the server did not receive a complete request from the client within the server’s specified timeout period.
409
Conflict
Used to indicate a conflict between the client’s request and the current state of the server.
410
Gone
Used to indicate that the requested resource is no longer available on the server and will not be available again in the future.
411
Length Required
Used to indicate that the server requires the “Content-Length” header to be included in the client’s request.
412
Precondition Failed
Used to indicate that one or more conditions specified in the client’s request headers are not met by the server.
413
Content Too Large
Used to indicate that the server refuses to process the request because the payload (e.g., request body) is too large. (Also known as Payload Too Large.)
414
URI Too Long
Used to indicate that the server cannot process the request because the URI (Uniform Resource Identifier) provided by the client is too long.
415
Unsupported Media Type
Used to indicate that the server refuses to accept the request because the media type of the request entity (e.g., request body) is not supported or not acceptable.
416
Range Not Satisfiable
Used to indicate that the server cannot fulfill the client’s request because the requested range of a resource is not available or valid.
417
Expectation Failed
Used to indicate that the server cannot meet the expectations specified in the “Expect” request header field.
5xx
5xx — Server Error
The server encountered an error while processing the request.
Status Code
Message
Explanation
500
Internal Server Error
Used to indicate an unexpected condition occurred on the server that prevented it from fulfilling the client’s request.
501
Not Implemented
Used to indicate that the server does not support the functionality required to fulfill the client’s request.
502
Bad Gateway
Used to indicate that the server acting as a gateway or proxy received an invalid response from an upstream server.
503
Service Unavailable
Used to indicate that the server is temporarily unable to handle the client’s request.
504
Gateway Timeout
Used to indicate that the server acting as a gateway or proxy did not receive a timely response from an upstream server.
505
HTTP Version Not Supported
Used to indicate that the server does not support the HTTP protocol version used in the client’s request.
507
Insufficient Storage
Used to indicate that the server is unable to store the representation needed to complete the client’s request.
511
Network Authentication Required
Used to indicate that the client must authenticate itself to gain network access.
These status codes are an essential part of the HTTP protocol and are used to communicate the outcome of a request between the client and the server.
They provide valuable information for developers, allowing them to handle different scenarios and troubleshoot issues when interacting with web servers.
Cheat Sheet
⚡ Quick Reference — Most Common Codes
Success
200 OK
Page loaded
Redirect
301 / 302
New URL
Not found
404
Missing page
Server
500
Server bug
Hands-On
Examples Gallery
Three Try It demos show how to read real HTTP status codes with fetch() and look up common codes. Plain HTML, no CSS.
Divide the code by 100 and take the integer part: 404 → 4xx (client error).
Applications
🚀 Why Status Codes Matter
Debugging — a 4xx points to the request or URL; a 5xx points to server code or infrastructure.
SEO — search engines treat 301/308 differently from 302; soft 404s (200 with empty content) hurt rankings.
APIs — REST APIs use 201 for create, 204 for delete-with-no-body, 409 for conflicts.
Caching — 304 Not Modified saves bandwidth by reusing cached assets.
User experience — custom 404 and 500 pages guide visitors when something goes wrong.
Monitoring — uptime tools alert when your site starts returning 503 or 502.
🧠 How HTTP Status Codes Work (Step by Step)
1
Client sends a request
The browser issues GET /page HTTP/1.1 (or POST, PUT, etc.) to the server.
2
Server processes it
The server routes the URL, runs code, reads files, or talks to a database.
3
Server sends status line
The first line of the response is HTTP/1.1 200 OK (code + reason phrase).
4
Headers and body follow
Content-Type, Cache-Control, etc., then HTML, JSON, or other data.
5
Client reacts
Browsers render HTML on 200, follow Location on 3xx, show error pages on 4xx/5xx.
Guidelines
Best Practices
Return the right code — do not send 200 OK for a missing page; use 404 (or 410 if gone permanently).
Use 301 for permanent moves — when renaming URLs, redirect old paths so bookmarks and SEO transfer.
Custom error pages — friendly 404 and 500 HTML pages help users recover.
Check APIs explicitly — always inspect response.status in fetch handlers.
Log 5xx on the server — client-side code cannot fix internal server errors; server logs are essential.
Wrap-Up
Conclusion
HTTP status codes are the language servers use to report what happened to each request. Memorize the five classes first, then the handful you see daily: 200, 301, 302, 404, and 500. Use the full tables above as a reference when you encounter less common codes.
An HTTP status code is a three-digit number the server sends in the response line (for example 200 OK or 404 Not Found). It tells the browser whether the request succeeded, was redirected, or failed.
200 OK means the server successfully received, understood, and processed the request. It is the standard success code for GET requests that return a page or resource.
301 Moved Permanently tells browsers and search engines the URL has changed forever — link equity should move to the new URL. 302 Found is a temporary redirect — the original URL may still be the canonical one.
404 means the server could not find a resource at the requested URL. Common causes: typo in the link, deleted page, or missing file. Fix broken links or add a redirect to the correct page.
500 indicates an unexpected problem on the server while processing a valid request — often a bug in server-side code, misconfiguration, or database failure. Check server logs to diagnose.
Open DevTools → Network tab, reload the page, and click a request. The Status column shows the code. In JavaScript, fetch() returns response.status after a request completes.
Did you know?
Status codes are not part of HTML markup — they belong to the HTTP protocol layer. HTML pages are just one type of content the server may return alongside the status line. You see them in DevTools Network tab, not in your <html> source.