Why validate?
Browsers are forgiving — they'll guess what you meant when your HTML is broken. That guess is different in every browser, which is how a page that looks perfect for you breaks for someone else. A validator catches those problems before anyone sees them.
Catch hidden bugs
Unclosed tags, duplicate IDs, and typos that "work" for you but break elsewhere.
Better accessibility
Missing alt text and bad structure hurt screen-reader users — the validator flags many of these.
Better SEO
Search engines reward clean, well-structured markup. Valid pages are easier for them to read.
You learn faster
Each clear error message teaches you the correct way to write the markup. It's free tutoring.
The two official W3C validators
The W3C (the group that writes the web standards) runs free validators. There's one for HTML and a separate one for CSS — both completely free, no account needed.
HTML Validator
Checks your HTML structure — tags, nesting, attributes, and required pieces like alt and lang.
CSS Validator
Checks your CSS — misspelled properties, invalid values, and syntax slips like a missing ; or }.
Three ways to validate
Every validator gives you the same three options. Pick whichever fits where your page lives right now.
- By URL — your page is already online (e.g. on Netlify or GitHub Pages)? Paste its web address and hit Check.
- By file upload — choose the
.htmlfile from your computer and upload it. - By direct input — copy your code and paste it straight into the box. Fastest while you're still building.
Errors vs. warnings
The validator returns a list of messages. Each tells you the line number and what's wrong. Two kinds matter:
e.g.
End tag </div> seen, but there were open elements.Common errors & what they mean
<div>) but never closed it. Add the matching </div>.alt attribute — every <img> needs alt="…" describing it (or alt="" if decorative).id is used twice. IDs must be unique; use a class instead.Validate without leaving VS Code
Going to a website every time is slow. The W3C Web Validator extension (by Celian Riboulet) runs the same checks right inside your editor. Here's how to use it, step by step.
Install it (once)
- Open the Extensions panel — ⌘ Shift X (Mac) / Ctrl Shift X (Windows), or click the four-squares icon in the sidebar.
- Search W3C Web Validator and confirm the publisher is Celian Riboulet.
- Click the blue Install button. (Full walkthrough: VS Code Setup, Step 2.)
Run it on a page
- Open the
.htmlfile you want to check (it must be the active editor tab). - Open the Command Palette — ⌘ Shift P / Ctrl Shift P.
- Type validate and choose the W3C Web Validator: Validate command, then press Enter.
- It sends your markup to the W3C and brings the results back into VS Code.
Read & fix the results
- Open the Problems panel — ⌘ Shift M / Ctrl Shift M (or View → Problems).
- Errors and warnings are listed with their line numbers; squiggly underlines also appear in your code.
- Click a problem to jump straight to that line, then fix it.
- Run the validate command again. Repeat until the list is empty — zero errors. 🎉
Make it a habit
Do
- Validate before you submit or publish
- Fix HTML errors first, then CSS
- Read the message and the line number
- Aim for "No errors" — then a clean conscience
- Re-validate after big changes
Don't
- Assume "looks fine in my browser" means correct
- Ignore errors because the page still renders
- Fix only the first error and stop — one cause can spawn many
- Panic at warnings — read them, then decide
- Wait until launch day to validate