How to use the HTML validator
- Paste your markup into the HTML box. The sample shows a page with several typical mistakes.
- Read the summary: the number of Errors and Warnings.
- Work through the Issues table. Each row gives the Line, Column, Severity and a plain message.
- Fix the first error first, then check again. One unclosed tag can cause a second message further down.
- Download the table as html-issues.csv if you want to share the list.
What it does and when to use it
Browsers never refuse broken HTML. They repair it silently, and the repair is not always what you meant: a paragraph closes early or a style hits the wrong element. This tool shows where that repair would happen.
Use it before you paste markup into a CMS or an email template, and after hand-editing a page. Messy exports from word processors are easier to check after the HTML Cleaner has removed the clutter. If the problem is hard to see, run the code through the HTML Formatter first; wrong indentation often points at the same line the validator reports.
What it checks
- Errors: unclosed or mis-nested elements, stray end tags, end tags on void elements such as
br, unclosed tags or comments, duplicate attributes, duplicate ids, ids with spaces, a link inside a link. - Warnings:
imgwithoutalt, obsolete tags such ascenterorfont, unknown tag names,lioutside a list,tdoutside a table, alabel forthat matches no id, and a missing doctype,lang,titleor charset.
How it works
The tool reads your HTML with its own tokenizer and keeps a stack of open elements, the way a browser parser does. It applies the optional end-tag rules, so <li>a<li>b is valid. Content inside svg and math is skipped, and tag names with a hyphen count as custom elements. Nothing is uploaded; the check runs in your browser.
Worked examples
A link inside a link and a broken label. This list puts one link inside another, and the label points to mail while the input’s id is email:
<ul>
<li><a href="/a">One <a href="/b">two</a></a>
</ul>
<label for="mail">Email</label><input id="email">
Result: 1 error and 1 warning. Line 2, column 24: <a> inside another <a> is not allowed. Line 4: <label for="mail"> points to an id that does not exist. A broken label also means a screen reader will not announce the field’s name.
A div inside a paragraph. <p>Intro<div>Box</div></p> gives Stray end tag </p> with no matching open element. The div closed the paragraph automatically.
Optional end tags. <table><tr><td>a<td>b</table><p>Fine<p>Also fine returns “No problems found”, because every missing end tag here is allowed.
Limits and tips
- It does not check attribute values, required attributes or ARIA roles. To review attributes, list them with the HTML Attribute Extractor.
- An unclosed inline tag, such as a
bnear the top, is reported where it was opened, with the line of the end tag that exposed it. - Fix duplicate ids first. Labels, anchors and scripts that use the id will only ever find the first element.
Frequently asked questions
Is this the same as the W3C validator?
Why does it call my closing p tag "stray"?
Why are missing closing li or td tags not reported?
Can I check a fragment instead of a full page?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.