HTML Validator Online — Free HTML Syntax Checker

Catch unclosed tags, deprecated elements, missing alt attributes, and unquoted attribute values before they ship. Browser-side validation — no upload, no rate limits.

What is an HTML Validator?

An HTML validator checks markup for structural correctness: are all tags closed, do void elements (<br>, <img>) appear without spurious close tags, are deprecated tags (<font>, <center>) absent, do <img> elements carry an alt attribute, and are attribute values quoted? Invalid HTML still renders in lenient browsers, but it breaks accessibility tooling, complicates CSS targeting, and surfaces as flaky bugs in older clients.

The OpenFormatter HTML validator runs a stack-based tag scanner plus a DOMParser-driven semantic check entirely in your browser. It is fast, private, and tuned to the issues that most often slip through review — not exhaustive HTML5 conformance (use the W3C validator for that).

How to validate HTML — 4 steps

  1. Paste your HTML. Full document or fragment — both work.
  2. Click Validate. The tool runs tag-matching, void-element, deprecated-tag, and attribute checks in one pass.
  3. Read the issue list. Each issue describes the tag and the reason. Document statistics appear at the bottom for context.
  4. Fix and re-run. Iterate until the green Valid badge appears.

Common errors the validator catches

1. Unclosed tag

<!-- ✗ <ul> never closed -->
<ul>
  <li>One</li>
  <li>Two</li>

<!-- ✓ correct -->
<ul>
  <li>One</li>
  <li>Two</li>
</ul>

2. Deprecated tag

<!-- ✗ deprecated -->
<font color="red">Notice</font>

<!-- ✓ HTML5 -->
<span style="color:red">Notice</span>

3. Missing alt

<!-- ✗ no alt -->
<img src="hero.png">

<!-- ✓ alt present -->
<img src="hero.png" alt="Smiling team in office">

Sample input and output

Input

<div>
  <font>old</font>
  <img src=hero.png>
  <p>missing close
</div>

Report

Issues found: 4
1. Deprecated tag <font>
2. <img> missing alt attribute
3. Unquoted attributes: 1
4. Unclosed <p>

Stack-based matching

Tracks open tags on a stack and pairs each close with the most recent open. Reports unmatched and unclosed tags by name.

Deprecated detection

Flags font, center, marquee, big, strike, tt, u, frame, frameset, dir, acronym, and xmp — all removed or obsoleted in HTML5.

Accessibility checks

Warns when <img> has no alt attribute. Decorative images should still carry alt="" to signal "skip this" to screen readers.

Common use cases

  • check_circleValidating server-rendered HTML before pushing to production
  • check_circleChecking CMS-exported HTML for unclosed tags before re-import
  • check_circleAuditing third-party widget embed code for deprecated tags
  • check_circleVerifying email template HTML before sending campaigns
  • check_circleCatching missing alt attributes during accessibility review
  • check_circleConfirming attribute quoting in handwritten markup
  • check_circleSanity-checking minified output of a template engine
  • check_circleReviewing PR diffs for accidentally introduced unclosed tags

Validator vs. formatter vs. linter

A validator reports structural errors without rewriting source. A formatter rewrites whitespace without checking validity. A linter goes further than a validator — it warns on style violations (bem class names, max nesting depth, redundant attributes) that pass HTML5 conformance but break team conventions. This tool is a validator: structural sanity, not stylistic policing.

Need to fix what you find?

Format, view, or edit HTML next — all browser-side.

Frequently Asked Questions

What does this HTML validator actually check?

Tag open/close matching using a stack, void-element handling (br, img, hr, input, meta, link, source, track, wbr — never need a close tag), deprecated tag detection (font, center, marquee, big, strike, tt, u, frame, frameset, dir, acronym, xmp), <img> elements missing the alt attribute, and unquoted id/class/src/href attribute values. It also reports document-level facts: DOCTYPE presence, title, and counts of scripts, links, images, and forms.

Is this the W3C HTML validator?

No. The W3C Markup Validator is the canonical conformance checker against the full HTML5 specification. This tool is a quick browser-side sanity check for the most common structural mistakes — useful when the W3C validator is overkill or when you cannot upload your markup.

Why does it warn about <img> missing alt?

The HTML specification requires alt on <img> for accessibility — screen readers cannot describe the image without it. Decorative images should still carry alt="" (empty string) to signal "skip this". This validator flags any <img> with no alt attribute at all.

How does it handle void elements like <br> and <img>?

Void elements never need a closing tag in HTML5. The validator recognises area, base, br, col, embed, hr, img, input, link, meta, param, source, track, and wbr — and does not push them onto its tag-matching stack. Both <br> and <br/> are accepted; the trailing slash is XHTML legacy and HTML5 ignores it.

What deprecated tags does it flag?

It flags acronym, big, center, dir, font, frame, frameset, marquee, strike, tt, u, and xmp. These were removed or made obsolete in HTML5. Use semantic alternatives: <strong>/<em> instead of <b>/<i> when meaning matters; CSS for visual styling instead of <font> or <center>; <iframe> instead of <frame>; and <abbr> instead of <acronym>.

Does it validate inline CSS or JavaScript?

No. Content inside <style> and <script> is treated as opaque text. For CSS use a CSS validator; for JavaScript run the JS Beautifier or a JS linter. This tool focuses on HTML structure only.

Can it validate an HTML fragment without <html> and <body>?

Yes. The validator checks tag matching on whatever you paste. DOMParser will wrap fragments in a synthetic body for parsing, so element counts will reflect that, but tag-mismatch detection works on the raw input.

Is my HTML uploaded for validation?

No. Validation runs entirely in your browser using DOMParser and a regex tag scanner. Page source containing internal layouts, hidden form fields, or proprietary markup never leaves your device. Verify in DevTools → Network: clicking Validate produces no requests.

HTML Validator Online — Free HTML Syntax Checker