HTML Validator

Paste HTML and instantly find out whether it's well-formed markup, with the exact line and column of the first error if it isn't. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-24

Overview

Introduction

Browsers are famously forgiving about malformed HTML, silently correcting problems that can still cause subtle rendering bugs.

This tool checks HTML structural well-formedness entirely in your browser, catching the mismatched or unclosed tags a browser would otherwise paper over.

What Is HTML Validator?

A well-formedness checker that parses your markup with Prettier's HTML parser and reports success or the first parse error.

It's a structural check (matched tags, valid nesting), not a full W3C spec conformance check.

How HTML Validator Works

The parser attempts to build a tree of elements from your markup.

If parsing succeeds, the markup is well-formed; if it fails, the exact line and column of the problem is shown.

When To Use HTML Validator

Use it when debugging unexpected rendering and you want to rule out a structural markup problem before checking CSS or JavaScript.

It's also useful for a quick pass/fail check on LLM-generated or copy-pasted HTML before adding it to a project.

Often used alongside HTML Formatter and HTML Minifier.

Features

Advantages

  • Runs entirely client-side.
  • Catches structural issues a lenient browser parser would silently paper over.
  • Uses the same Prettier HTML parser as the HTML Formatter, so a 'valid' result is one you can trust to also format cleanly.

Limitations

  • Doesn't check full W3C spec conformance (deprecated attributes, accessibility rules); use validator.w3.org for that.

Examples

Mismatched tags

Input

<div><p>Hello</div></p>

Output

Unexpected closing tag "div"

The parser reports the point where a closing tag didn't match the currently open element.

Best Practices & Notes

Best Practices

  • Use this before the HTML Formatter when you specifically want a fast pass/fail structural check without reformatting anything.
  • If validation fails on a template file (JSX, Handlebars, Vue SFC), strip the templating syntax first, since only plain HTML is supported.

Developer Notes

Reuses the same Prettier `html` parser as the HTML Formatter; the input is discarded on success and only the parse result matters.

HTML Validator Use Cases

  • Ruling out a structural markup problem when a page renders unexpectedly
  • Checking a generated or LLM-produced HTML snippet before using it

Common Mistakes

  • Assuming a 'valid' result means the page passes full W3C or accessibility validation; it only confirms basic well-formedness.
  • Pasting a JSX or templating-engine file directly; curly-brace expressions and directives aren't standard HTML and can trigger a false failure.

Tips

  • For full spec and accessibility validation, follow up with the W3C Markup Validation Service.
  • If a specific tag is flagged unexpectedly, check for a void element written with a mismatched closing tag, like </br>.

References

Frequently Asked Questions