HTML Validator
Check pasted or local HTML in document or fragment mode with line-aware findings and strict review signals without executing code in your browser.{{ summaryTitle }}
{{ summaryLine }}
| Location | Rule | Severity | Finding | What to do | Copy |
|---|---|---|---|---|---|
| L{{ finding.line }}:C{{ finding.column }}<{{ finding.element }}> | {{ finding.rule }}{{ finding.category }} | {{ finding.severity }} | {{ finding.title }}{{ finding.message }}{{ finding.excerpt }} |
{{ finding.guidance }} |
The chart renderer is unavailable. Counts remain available in the summary and finding ledger.
Repair plan
{{ group.title }}
{{ group.count }} {{ group.count === 1 ? 'finding' : 'findings' }}- {{ item.rule }} at L{{ item.line }}:C{{ item.column }}: {{ item.guidance }}
No repair action is required by the supported rules in this pass.
Scope boundary
This local ruleset preserves the source and does not certify rendering, accessibility, links, security, browser compatibility, or complete HTML conformance. Use a full conformance checker and browser/accessibility testing before release.
HTML browsers recover from many authoring mistakes instead of stopping at the first bad tag. A missing end tag may be inferred, a stray closing tag may be ignored, and a repeated attribute may lose one of its values. The page can still look reasonable while the browser has built a document tree different from the one the author intended.
Validation makes that recovery visible before it turns into broken labels, duplicate fragment links, unreliable scripts, or inconsistent table relationships. It also separates complete documents from fragments. A document normally needs a doctype, title, and primary language; a fragment copied from a template or component does not own those page-level requirements.
- Document
- A complete HTML resource with page-level structure and metadata, including the short HTML doctype.
- Fragment
- A piece of markup intended to be inserted into another document, such as a component example or server-rendered partial.
- Parse recovery
- The browser rules that continue parsing after malformed or omitted markup. Recovery can preserve a visible page while changing element nesting.
- Conformance finding
- A source-level problem such as a duplicate identifier, invalid label target, or disallowed table-header reference.
Not every authoring concern has the same certainty. Duplicate id values and a label that points to no labelable control are concrete defects. Heading jumps and missing image alternative text need more context, so they belong in a stricter review pass rather than the base result. An image may have a documented narrow exception, and a heading sequence can be deliberate in specialized content.
Markup validation is still only one part of web quality. It cannot decide whether CSS renders correctly, a link resolves, JavaScript behaves safely, form instructions are understandable, or an accessibility tree supports the intended task. Those questions need browser inspection, accessibility testing, link checks, and project-specific review after source findings are cleared.
Treat a clean HTML report as evidence that the supported source rules passed. It is not a browser, sanitizer, security scanner, accessibility audit, or universal conformance certificate.
How to Use This Tool:
Identify the source as a complete document or fragment before judging page-level findings.
- Paste markup into HTML source or load one local HTML or text file no larger than 200 KB.
- Set Mode to Document or Fragment when the context is known. Auto detect chooses Document when it sees an HTML doctype or an
html,head, orbodyelement; otherwise it chooses Fragment. - Use Recommended for syntax, recovery, identifiers, forms, tables, entities, and document metadata. Choose Strict review when heading order, repeated top-level headings, and missing image
altattributes should also be raised for judgment. - Enter Expected language only when the surrounding page or publishing workflow declares one. A value such as
en,en-US, orzh-Hantcan reveal a mismatch with the documentlangvalue. - Fix errors from the earliest source location first, then validate again. Turn on source excerpts only when copied or downloaded finding rows need the affected line for review.
Interpreting Results:
Errors identify supported syntax, recovery, or conformance problems. Repair malformed tags, duplicate attributes, mismatched nesting, duplicate identifiers, invalid label or table references, and invalid character references before relying on later warnings.
Warnings ask for context. A missing document title or language needs author attention, while strict-review heading and image signals need a deliberate content or accessibility decision. The resolved mode and review profile belong with the result because the same fragment can produce different page-level findings when treated as a document.
No findings does not mean the page is accessible, secure, fully conforming, or compatible with every browser. Render the source in its real application, test keyboard and assistive-technology behavior, follow links, and run the project's own build and policy checks before release.
Technical Details:
HTML parsing is not XML parsing. Some end tags may be omitted, void elements never have end tags, raw-text elements contain text that must not be scanned as ordinary markup, and specific start tags implicitly close an open element. Bounded analysis must model these distinctions before it can report a stray or unclosed tag without flooding the result with false positives.
Rule Core
The rule order moves from source bounds and tokenization into element relationships, then adds document-only and strict-review checks. Findings retain original line and column locations even when parser recovery closes an element implicitly.
| Rule group | Checks | Applies to |
|---|---|---|
| Token and tag structure | Comments, declarations, malformed tags, duplicate attributes, stray end tags, void-element endings, recovery closures, and required end tags | Every mode |
| Identifiers | Non-empty id values without whitespace and uniqueness across the submitted source | Every mode |
| Forms and tables | label for resolves to one non-hidden labelable element; headers resolves to unique th identifiers; scope uses a defined keyword | Every mode |
| Character references | Numeric references use valid scalar values and semicolons; core named references include their semicolons | Every mode |
| Document metadata | One short HTML doctype, one non-empty title, and a valid primary language when declared | Document mode |
| Language context | The document language equals the expected tag or begins with that tag plus a subtag | Document mode when an expected language is supplied |
| Strict review | Skipped heading levels, more than one h1, and images without an alt attribute | Strict review profile |
Auto detection is intentionally simple and deterministic. After comments are ignored, an HTML doctype or explicit html, head, or body element resolves the source as a document. Other source resolves as a fragment. Pinning the mode avoids accidental changes when a snippet gains one of those page-level tokens.
Language tags are checked against a bounded BCP 47 syntax pattern, including recognized grandfathered and private-use forms. The check does not consult the live language-subtag registry. When an expected language is present, en-US matches expected en, but expected en-US does not match an actual en because the document is less specific than the requested context.
| Limit | Maximum | Result behavior |
|---|---|---|
| Unicode characters | 200,000 | Larger source is rejected. |
| Lines | 5,000 | Larger source is rejected. |
| Tokens | 20,000 | Analysis stops at the boundary and reports truncation. |
| Open-element depth | 256 | Deeper nesting reaches the analysis boundary. |
| Attributes on one tag | 100 | Later attributes are not analyzed. |
| Reported findings | 200 | Only the earliest ordered findings are returned. |
The submitted markup remains inert. Scripts are not executed, resources are not fetched, CSS and SVG are not validated, and the source is not repaired or reformatted. Those exclusions protect the meaning of the report: it describes the supported HTML source rules only.
Limitations:
A bounded source review cannot replace a full conformance checker or a rendered test. It does not evaluate content models comprehensively, follow links, resolve custom elements, inspect framework templates, execute scripts, calculate accessible names, or certify assistive-technology support.
- Use a standards-grade HTML checker when complete conformance coverage is required.
- Use browser developer tools and automated accessibility checks for the rendered document, followed by keyboard and assistive-technology testing for important flows.
- Validate generated HTML after templates render; a clean template fragment does not prove that its assembled document is clean.
References:
- HTML syntax, WHATWG HTML Living Standard, updated 31 August 2026.
- HTML forms, WHATWG HTML Living Standard, updated 31 August 2026.
- RFC 5646: Tags for Identifying Languages, RFC Editor, September 2009.