HTML Validator
This HTML validator checks your code for errors, accessibility problems and missing essentials — with a fix for each one.
HTML to check
Results
2 errors, 6 warnings, 2 suggestions.
Runs locally in your browser. This is not the official W3C validator.
How to validate HTML
- Paste your HTML, or open or drop an .html file.
- Results appear instantly, grouped as errors, warnings and suggestions, each with its line and column.
- Click a result to jump to that line in the code, then apply the suggested fix.
What this HTML checker looks for
- Structure: unclosed elements, stray end tags, misnested tags, links inside links, nested forms and self-closing
<div/>tags. - Uniqueness: duplicate
idvalues and duplicate attributes on the same element. - Accessibility: images without alt text, inputs without labels, empty links and buttons, iframes without a title.
- Document essentials: doctype,
lang, title, character encoding, viewport and meta description. - Obsolete markup: elements like
<center>,<font>and<marquee>, with modern replacements.
The checker understands HTML's optional end tags, so valid shortcuts such as leaving out </li> or </p> are not reported as errors.
Example: fixing misnested tags
Browsers silently repair broken markup, so a page can look fine while its structure is wrong — which then breaks styling, scripts and screen readers in hard-to-debug ways. The validator reports the <strong> below as not closed before </p>:
<p>Read the <strong>terms</p></strong><p>Read the <strong>terms</strong></p>Common HTML errors and how to fix them
These are the problems the validator finds most often, with the exact message it shows and a corrected version:
| Problem | Invalid | Message | Fixed |
|---|---|---|---|
| Duplicate id | <div id="nav"></div>
<div id="nav"></div> | Duplicate id "nav" (first used on line 1). | <div id="nav"></div>
<div id="footer-nav"></div> |
| Element not closed | <section><div>Text</section> | <div> (line 1) is not closed before </section>. | <section><div>Text</div></section> |
| Link inside a link | <a href="/a">Read <a href="/b">more</a></a> | Links cannot be nested inside other links. | <a href="/a">Read</a> <a href="/b">more</a> |
| Image without alt text | <img src="logo.png"> | <img> is missing an alt attribute. | <img src="logo.png" alt="Acme logo"> |
| Input without a label | <input type="email" name="email"> | <input> has no label. | <label>Email <input type="email" name="email"></label> |
| Obsolete element | <center>Hello</center> | <center> is obsolete in HTML5. | <p class="centered">Hello</p> |
Check and correct HTML
To check HTML code, paste it or open the file — the HTML checker runs as you type. Each finding says what is wrong, why it matters and how to correct it, and clicking it jumps to the exact line. You make the change yourself in the editor, so nothing in your code is rewritten without you seeing it.
- Fix errors first: unclosed or misnested tags change how browsers build the page.
- Then warnings: missing alt text and labels affect screen-reader users.
- Finally suggestions such as heading order. Re-check until the HTML code checker reports no errors, then verify the page in the HTML viewer.
How it compares to the W3C validator
This is an independent HTML syntax checker, not the official W3C Markup Validation Service. It runs in your browser, so your code is never uploaded, and it explains every problem in plain language with a fix. For a full specification-conformance report of a published page, you can additionally run the W3C validator.
Related HTML tools
Hard to see the structure? Indent the code first with the HTML formatter, then fix issues live in the online HTML editor while watching the preview. When everything passes, shrink the page with the HTML minifier or check the rendering in the HTML viewer.
Frequently asked questions
- How is this different from the W3C validator?
- The W3C Markup Validation Service is the official reference: it checks a page against the full HTML specification and can fetch a live URL. This is an independent checker that runs in your browser, so your code is never uploaded. It focuses on the mistakes people make most — unclosed and misnested tags, duplicate IDs, missing alt text and labels, missing document essentials — and explains each one with a fix. It doesn't implement every rule in the specification, so for a formal conformance report, run the W3C validator as well.
- What does the HTML validator check?
- Structure (unclosed, stray and misnested tags, duplicate IDs and attributes), accessibility (missing alt text, labels, link and button text, iframe titles), document basics (doctype, lang, title, charset, viewport) and obsolete elements such as <center> and <font>.
- Why isn't a missing </p> or </li> reported?
- Because it is valid. HTML allows the end tags of elements such as <p>, <li>, <td> and <tr> to be omitted; the browser closes them automatically. The validator follows those rules, so it only reports real problems.
- What is the difference between errors, warnings and suggestions?
- Errors are invalid markup that browsers have to guess how to repair. Warnings are valid but cause real problems, often for accessibility. Suggestions are best practices, such as a logical heading order.
- Can I check a snippet instead of a whole page?
- Yes. When you paste a fragment without <html>, <head> or <body>, document checks like doctype and title are skipped and only the snippet itself is checked.
- Does the HTML checker fix my code automatically?
- No. It shows every problem with a suggested fix and jumps to the line, but you decide what to change. Automatic rewriting could silently alter content or layout, so the checker only advises.