HTML Validator
Check for unclosed tags, syntax errors, and structural issues in your HTML
Find unclosed and mismatched tags quickly
A missing closing tag rarely produces an error message in the browser; the page just looks subtly wrong. This validator checks the structure of the HTML you paste and tells you whether every opened tag has a matching close in the correct order. It is a fast first check for snippets, templates and hand-written pages, rather than a replacement for a full standards-compliance service.
Running a check
- Paste your code into the HTML Code editor, or use Paste to bring it in from the clipboard.
- Not sure what a result looks like? Try Valid Sample or Error Sample. The error sample has a heading that is never closed and a bold tag that is left open when its paragraph ends.
- Click Validate HTML Structure. (The samples run the check for you.)
- Look at the Status in the header, which shows VALID in green or INVALID in red, and at the message inside the Validation Report.
- Scroll through the Structural Breakdown to see every tag in order, labelled as an opening tag, closed successfully, a self-closing tag, or an unexpected closing tag.
How the check works
The tool scans your text for tags and keeps a running stack of the ones currently open. When a closing tag arrives, it must match the most recent open tag; otherwise you are told which closing tag was unexpected and which one was expected. Any tags left on the stack at the end are reported as unclosed. Void elements such as br, img, input, meta, link and hr do not need a closing tag, and neither does anything written with a trailing slash.
Where it earns its keep
- Checking a hand-edited email template for a stray missing div before sending it.
- Debugging why a section of a layout has collapsed or a style has leaked to the rest of the page.
- Confirming that a snippet pasted into a CMS is balanced before saving.
- Teaching beginners how nesting and closing order work.
What it does not cover
- It does not check attributes, doctype, required elements, accessibility or deprecated tags.
- Tags that HTML permits you to leave unclosed, such as p or li, are still reported as unclosed.
- Text inside comments, scripts and style blocks is scanned like markup, so a comparison like a less-than sign in code may confuse it.
- The message at the top describes the last problem found; the breakdown lists every tag.
Processing is done by JavaScript in your browser. For a formal compliance audit, use the official W3C checker as a second opinion.
Related Articles
Related Tools