How to use
- Paste the HTML you want to check. The box starts with a sample that contains several problems so you can see the result table straight away.
- Read the errors, warnings and info with their line and column. The right-hand column shows the code on that line.
- Fix errors first. The result refreshes as you edit. Use the checkboxes to show only the types you want.
You can paste a full document (with <html>, <head>, <body> or a doctype) or just a fragment. Fragments are not held to document-level rules such as doctype, lang and title.
What is checked
| Group | Checks |
|---|---|
| Tag matching | Unclosed elements, end tags with no start tag, overlapping tags like <b><i></b></i>, end tags on void elements such as </br>, ignored self-closing like <div/> |
| Syntax | Unclosed comments, tags and quotes, duplicate attributes on a tag, missing space between attributes, a bare < in text |
| ids | Duplicate ids, empty ids, ids containing spaces, <label for> pointing to a missing id |
| Nesting | <li> outside a list, <td> outside <tr>, an <a> inside an <a>, a <div> inside a <span>, block elements inside <p> |
| Elements and attributes | Non-standard elements, obsolete elements (font, center) and attributes (align, bgcolor, border on tables) |
| Basic accessibility | img alt and src, empty links and buttons, inputs without labels, iframe title, skipped heading levels, multiple h1 |
| Document | doctype, lang, title, meta charset |
Elements whose end tag may be omitted (li, p, td, tr, option and so on) are not reported when left open. <ul><li>a<li>b</ul> is valid HTML.
Sample result
The sample in the box contains these problems, and checking it gives 6 errors, 4 warnings and 1 info:
- Line 7:
<div id="box">is never closed (error) - Line 9: opening
<div>closes the<p>automatically (warning), and the idboxis reused (error) - Line 10:
</p>has no match because the p was already closed (error) - Line 11:
<img>has no alt (error). Line 12: the<a>has no content (warning) - Line 17:
<b><i></b></i>overlaps (2 errors) - Whole document: no doctype and no lang (warnings), no charset (info)
Limits of this checker
This is not a full validator such as the W3C Nu HTML Checker. It does not check the allowed values for each attribute, the complete list of children allowed in a <table>, or the exact use of ARIA roles. It is for catching the mistakes people make most often while writing. Before release, also run an official validator or the accessibility audit in your browser’s developer tools.
Browsers do not report HTML errors. They quietly repair the markup, so a page can look fine while the source has problems. Some warnings here describe repairs the browser already makes, so the page may look correct anyway.
Frequently asked questions
How does it find unclosed tags?
It keeps a stack of open tags and matches each end tag against it. With no match you get “unclosed element” or “end tag with no start tag”, and if other elements are still open in between you get an overlapping-tags error, each with line and column.
Why are duplicate ids a problem?
getElementById, #id anchor links and <label for> all assume one element per id. With duplicates only the first is found, so scripts and links go to the wrong place.
Is alt really required on images?
Yes. Screen readers read it and it is shown when the image fails to load. For decorative images use alt="" so screen readers skip them. Leaving the attribute out entirely is an error.
Does an empty result mean my HTML is perfect?
No. It only means nothing was found within the scope described under the limits above.
Related tools: HTML Beautify and Minify, XML Validator, HTML Entity Converter, Meta Tag Generator, CSS Beautify and Minify.
Your HTML is checked in your browser and never sent to a server.