GALAXY OF TOOLS

DEV SECTOR

HTML Validator

Find HTML parse errors, unclosed tags, duplicate ids, missing alt text and other problems, line by line.

The checker (about 190 KB) loads the first time you validate.

This is not the W3C Nu HTML Checker. It combines the HTML specification’s parse errors (via parse5) with html-validate’s rules and page-level checks. It does not validate CSS or JavaScript, fetch linked files, or check every ARIA and content-model rule.

Runs entirely in your browser. Nothing you enter or upload is sent to a server.

Validate HTML and find the exact line of every problem

The HTML Validator checks HTML in your browser and lists every problem with its line and column, a severity, the rule that caught it and advice on how to fix it. Paste a page or a snippet, or open an .html file, and it finds unclosed and misnested tags, duplicate ids, obsolete elements and attributes, images without alt text, form fields without labels, links wrapped around buttons, and pages missing a language, title, character encoding or viewport.

It combines three layers. The parse5 parser (MIT) reports the parse errors defined by the WHATWG HTML specification — duplicate or run-together attributes, broken comments, unknown entities, a missing doctype. The html-validate linter (MIT) checks structure, content models and accessibility. A small set of page-level checks adds lang, title, charset and viewport.

Your markup never leaves the device, so you can check templates, intranet pages and unpublished work safely.

How to use the HTML Validator

  1. Paste HTML into HTML to check, drop a file on it, or press Open file.
  2. Leave the input type on Auto-detect, or choose Full page or Fragment. Page-level checks (doctype, lang, title, charset, viewport) only run for full pages.
  3. Keep Accessibility checks on for alt text, labels and headings; tick Style checks for consistency rules such as quoting and inline styles.
  4. Press Validate HTML. After the first run the results update as you type.
  5. Filter by Errors or Warnings, and press Show in editor to jump to each problem.

HTML Validator features

Specification parse errors

Errors use the spec’s own codes, such as missing-whitespace-between-attributes, each linked to its definition in the HTML standard.

Structure and nesting

Unclosed elements, stray end tags, a <div> inside a <p>, interactive elements nested inside links, and list items or cells outside their parents.

Accessibility basics

Missing alt text, unlabeled inputs, links and buttons without text, skipped heading levels and forms without a submit button.

Page essentials

Doctype, <html lang>, <title>, UTF-8 charset within the first 1,024 bytes, and the mobile viewport tag.

Fewer cascades

One unclosed element can make a linter report every ancestor. Follow-on errors are folded, so you see the cause rather than ten symptoms.

Worked example

Validate this page body (the doctype and head are fine, so only body problems appear):

  • <p id="intro">Hello</p> on line 9 and <span id="intro"> on line 11 → error, line 11, column 11, no-dup-id: “Duplicate ID "intro"”.
  • <img src="photo.jpg"> on line 10 → error, line 10, column 2, wcag/h37: the image is missing alt.
  • <p class="a"class="b"> on line 12 → missing-whitespace-between-attributes from the spec and no-dup-attr, both at column 13.
  • <a href="/"><button> → element-permitted-content: a button is not allowed inside a link.

What it does not check

This tool is not the W3C Nu HTML Checker and does not claim to replace it. parse5 reports the tokenizer errors and a few tree-construction errors defined by the specification, not all of them; html-validate applies its own reading of content models and ARIA, which is close to the spec but not identical. CSS and JavaScript inside the page are not validated, linked stylesheets, scripts and images are not fetched, and template syntax (Handlebars, JSX, PHP) is treated as plain text. Custom elements such as <my-widget> are accepted without checking their attributes.

Use it as a fast first pass while editing. Before a launch, also run the page through a full validator and an accessibility audit with real assistive technology.

Common HTML errors and their fixes

After fixing errors, tidy the indentation with the Code Beautifier, preview the result in the HTML Viewer, and shrink it for production with the HTML Minifier.

ProblemWhy it mattersFix
<div> inside <p>The paragraph closes early and the later </p> becomes an empty paragraphUse a <div> wrapper or close the paragraph first
Duplicate idLabels, anchors and scripts reach only the first elementMake ids unique; use classes for styling
Missing altScreen readers announce the file name insteadalt="Red lawn mower", or alt="" if decorative
Input without labelThe field has no accessible name; a placeholder disappears when typing<label for="email"> plus id="email"
<center>, <font>, align=Obsolete since HTML5Move presentation to CSS

HTML Validator FAQ

Is this HTML validator free and private?

Yes. It is free with no sign-up, and validation runs in your browser. Your HTML is not uploaded; only the checker libraries are downloaded from a public CDN.

Is this the same as the W3C validator?

No. The W3C Nu HTML Checker is a separate, more exhaustive service. This tool reports HTML-specification parse errors through parse5 plus html-validate’s structure and accessibility rules, instantly and offline-friendly, but it does not cover every rule the Nu checker does.

How do I check HTML for unclosed tags?

Paste the HTML and press Validate HTML. Unclosed elements appear as close-order errors at the start tag that was left open, and stray end tags are reported where they occur. Follow-on errors are folded so the first real cause is easy to spot.

Why is a div inside a p an error?

A paragraph may only contain phrasing content such as text, links and spans. When the parser meets a div, it closes the paragraph automatically, so your later </p> has nothing to close and creates an empty paragraph instead.

Can I validate a fragment instead of a whole page?

Yes. Snippets without a doctype or <html> are detected as fragments automatically, and page-level checks such as title and charset are skipped. Choose Full page or Fragment to override the detection.

Does it check CSS, JavaScript or broken links?

No. It checks HTML markup only. It does not run scripts, validate stylesheets or request linked files, so broken links and missing images are not detected.

You might also need