Paste some code on the left — it validates as you type.

About the HTML Validator

What is an HTML validator?

An HTML validator scans your markup for the mistakes browsers hide from you. Browsers are famously forgiving — they'll render a page with unclosed tags, duplicate ids, and mismatched nesting without a single complaint — but that forgiveness has a cost: layouts that break only in one browser, JavaScript that targets the wrong element, styles that apply twice, and screen readers that lose their place. This tool finds those problems while they're still one click away from the fix.

It checks the things that actually break pages: unclosed and mismatched tag pairs, duplicate id attributes (the classic cause of "getElementById returns the wrong element"), the same attribute declared twice on one tag, empty src attributes that trigger a useless request to your own page, unescaped special characters, and missing alt text on images. Optional toggles add full-document checks (doctype and title) and style conventions (lowercase tags, double-quoted attributes) when you want them. Each finding shows the rule, the exact line and column, and a code frame — click it and the editor jumps there. Everything runs in your browser; nothing is uploaded.

How to Use This Tool

  1. Add your HTML. Paste a fragment or a whole document, click Open file, or try the Valid and Broken samples.
  2. Pick your strictness. Correctness checks are always on; enable full-document and style checks when they fit what you're validating.
  3. Click any result. The editor jumps to the exact line so you can fix it immediately.
  4. Watch it re-check. Validation runs live as you type, so the list empties as you clean up.

Common Use Cases

  • Debugging layout weirdness: An unclosed div three screens up is the classic cause — find it in seconds.
  • Checking CMS and email templates: Validate fragments exactly as they're stored, without needing a full document.
  • Accessibility passes: Missing alt text is the fastest accessibility win on most sites.
  • Reviewing generated markup: Catch duplicate ids and attributes that template loops love to produce.

Once it's clean, the HTML Formatter beautifies it, the HTML Minifier compresses it safely, and the HTML Viewer previews it live. Or browse all our free developer tools.

Frequently Asked Questions

Is this the same as the W3C validator?

It's complementary. The W3C service checks the full HTML specification on their servers; this tool runs instantly in your browser and focuses on the practical mistakes that actually break pages — unclosed tags, duplicate ids and attributes, empty src, missing alt. For most day-to-day work it catches what matters, without uploading your markup anywhere.

Can I validate a fragment, or does it need a full document?

Fragments are first-class. Doctype and title checks are behind a toggle precisely so a template partial or CMS snippet doesn't drown in irrelevant warnings. Turn the toggle on when you're checking a complete page.

Why are duplicate ids such a big deal?

Because everything that looks up elements by id — JavaScript, label "for" attributes, anchor links, ARIA references — silently binds to only the first match. The rest of your page behaves as if those elements don't exist, which produces bugs that are miserable to trace back.

What does the empty-src check protect against?

An img or script with src="" makes many browsers request the current page URL again — a wasted, sometimes side-effect-triggering request that doubles server load on busy pages. It's almost always a template bug worth fixing.

Do the style rules affect validity?

No — uppercase tags and unquoted attributes are valid HTML5. The style toggle is for teams that want consistent conventions; leave it off if you only care about correctness.

Is my markup uploaded anywhere?

No. Validation runs entirely in your browser with a locally served checker — no CDN, no server round trips, no logging. It even works offline once the page has loaded.