When a browser loads your HTML page, an image, a stylesheet, or a script, the server answers with an HTTP status code—a three-digit number that says whether the request worked, redirected, or failed.
Status codes are not HTML tags. They sit in the HTTP layer around your document. As an HTML author you meet them most often as broken <a> links (404), missing <img> files, permanent URL moves (301), and custom error pages.
First digit = class.
2xx success, 3xx redirect, 4xx client/URL problem, 5xx server problem. Memorize those four for day-to-day HTML work.
Beginner tip.
In DevTools → Network, every HTML, CSS, JS, and image request shows a Status. In JavaScript, fetch() exposes response.status and response.ok (true for 200–299).
Soft 404 trap.
Do not return 200 OK with an empty “page not found” HTML body. Use a real 404 (or 410 if the page is gone forever) so browsers and search engines understand.
Response shape
How a Response Looks
response.txt
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html>
<html lang="en">
<!-- your HTML document -->
</html>
Pattern: browser requests a URL → server sends a status line (200 OK, 404 Not Found, …) → headers → optional body (often your HTML).
Reference
Five Status Classes
RFC 9110 groups responses by the first digit:
Class
Range
Meaning for HTML authors
1xx
100–199
Informational — rare in everyday page loads
2xx
200–299
Success — HTML / assets delivered
3xx
300–399
Redirection — browser follows a new URL
4xx
400–499
Client error — bad link, auth, or request
5xx
500–599
Server error — hosting or app failure
Cheat sheet
Codes You See With HTML Pages
Focus on these while building and debugging sites:
Code
Name
HTML author note
200
OK
Page or file loaded successfully
301
Moved Permanently
Old URL renamed forever — update <a href> and sitemaps
Code: 404
Class: 4xx — Client Error
Meaning: Not Found — page or file missing
How It Works
Divide by 100 for the class (404 → 4xx).
Map common codes to short HTML-friendly meanings.
Open Try It for a live interactive lookup.
Use tables above for less common codes.
Edge Cases & Pitfalls
Most HTML-related status bugs are wrong codes for missing pages or silent broken assets.
404
Broken links and images
Check Network for red 404 rows after you change href / src. Fix paths or redirect.
200
Do not fake 404 with 200
A friendly error page still needs a 404/410 status so SEO and tools stay honest.
301
Permanent moves need 301/308
Renaming a page? Redirect the old URL and update internal links.
fetch
fetch does not throw on 404
Only network failures reject the promise. Always read response.status.
Browsers
Browser Support
All modern browsers understand standard HTTP status codes when loading HTML and assets.
Feature
Support
HTTP status line (1xx–5xx)
All modern browsers
DevTools Network Status column
Chrome, Firefox, Edge, Safari
fetch()response.status / ok
All modern browsers
Following 3xx redirects
Automatic in browsers (APIs can customize)
Remember
Key Takeaways
Not HTML markup—status codes wrap how your pages are delivered.
2xx / 3xx / 4xx / 5xx cover almost every HTML debugging case.
404 usually means fix a link or file path.
Use DevTools Network to see status for every HTML asset.
One line: learn the five classes, then treat daily HTML work as a loop of 200, 301, 404, and 500.
Frequently Asked Questions
A three-digit number the server sends with every response (for example 200 OK or 404 Not Found). It tells the browser whether the HTML page, image, or other resource loaded, redirected, or failed.
No. They belong to HTTP. Your HTML file is the body of a successful response. You see codes in DevTools Network, not inside the <html> source.
The server found the resource and returned it. For a normal page visit, that usually means the HTML document (and later its CSS, JS, and images) loaded successfully.
The URL does not match a resource. Common HTML causes: typo in an a href or img src, a deleted page, or a missing file. Fix the link or add a redirect.
301 Moved Permanently means the URL changed forever (search engines should update). 302 Found is temporary — the original URL may still be the main one.
Open DevTools → Network, reload, and check the Status column. In JavaScript, fetch() exposes response.status and response.ok after each request.