Back to Tools

HTML Validator

Check for unclosed tags, syntax errors, and structural issues in your HTML

READY
HTML Code
1

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

  1. Paste your code into the HTML Code editor, or use Paste to bring it in from the clipboard.
  2. 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.
  3. Click Validate HTML Structure. (The samples run the check for you.)
  4. Look at the Status in the header, which shows VALID in green or INVALID in red, and at the message inside the Validation Report.
  5. 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






Frequently Asked Questions

Does VALID mean my page follows HTML standards?
No. It only means every opening tag has a matching closing tag in the right order. Attributes, doctype, allowed nesting and accessibility are not checked, so use a full standards validator before publishing an important page.
Why is an unclosed p or li tag flagged as an error?
HTML allows closing tags for p and li to be omitted, but this tool follows a strict stack rule and expects every non-void tag to be closed. Adding the closing tag makes the report clean and the code clearer.
Which tags are treated as self-closing?
The list includes area, base, br, col, embed, hr, img, input, link, meta, param, source, track and wbr. Any tag ending with a slash before the closing bracket, such as a custom self-closed element, is also accepted.
Why does the error message mention only one problem?
The summary text shows the most recent mismatch the scan found. The Structural Breakdown below lists every tag in order, so scroll through it and look for lines marked as unexpected to find all of the trouble spots.
Can it validate a full page with a doctype and scripts?
You can paste a full document, and the doctype line is ignored. Script and style contents are scanned as if they were markup, so stray angle brackets in code can produce false errors. Remove those blocks if you see odd results.
Support Chat
We typically reply within minutes

Hello! 👋 Before we start, please tell us your name.