⭐ 0

HTML Validator

Check that HTML tags nest and close, and that quotes inside a tag are finished.

🔒 Processed entirely in your browser — nothing you enter here is ever uploaded.

The result appears on this page after you run the tool. Nothing you enter is uploaded.

Processing... 0%
Scanning tags
Checking quotes
Matching open and close tags
Looking for unclosed elements
Compiling the report

Result

About this tool

Paste markup and run the check. The scanner looks for tags with a regular expression: an optional slash, a name of letters, digits, colon, or hyphen, then everything up to the next >. Names that start with ! or ? are skipped, so a doctype and a comment do not sit on the stack. A closing tag must match the tag currently on top. Tag names are compared in lowercase, so </DIV> closes <div>. If the stack is empty at a close, the message is an unexpected closing tag. If the names differ, the message names the tag it expected and the line where that tag was opened.

The fragment <div><p></div> fails on the closing div. p is not a void tag, so it is still open, and the checker says it expected </p>. Close the paragraph first, </p></div>, and the same fragment passes with the message HTML syntax is valid. A quote that is opened inside a tag and not closed before the > fails as malformed attributes, with the line number. When the result has a line, the page reprints a couple of lines around it. A column, when the checker has one, gets a caret.

Void tags may omit a closer: img, br, hr, input, meta, link, source, area, base, col, embed, param, track, and wbr, and any tag written with /> is also treated as complete. The checker does not require alt, does not care about a doctype, and does not apply the HTML5 content model, so a div inside a p can still pass if the tags pair up. The markup stays in the browser. The W3C Nu validator is the tool that applies the full content model.

Example. The fragment <div><p></div> fails on the closing div, because the checker still expects </p> from the p that was opened.

Limit. Void tags such as img, br, meta, and input need no close tag. The checker matches tag names and quote marks. It does not apply the HTML5 content model or require attributes such as alt.

What does this HTML validator actually check?

It scans tags with a regular expression, ignores names that start with ! or ?, and keeps a stack of open elements. A closing tag must match the last open tag. A quote that is still open at the end of a tag is an error. The message includes the line, and the page draws that line with a caret when it has a column.

Why did <div><p></div> fail?

p is not in the void-tag list, so it is pushed on the stack. The next close is div, which does not match p, so the result is a mismatched closing tag that expected </p>. Swap in </p></div> and the same fragment passes.

Will it catch a missing alt or a bad doctype?

No required-attribute or doctype rule runs. img, br, hr, input, meta, link, source, area, base, col, embed, param, track, and wbr may omit a close tag. Tag names are compared in lowercase. Paste the markup; the check stays in the browser.