Skip to content

HTML Validator

Check HTML for errors right in your browser. Paste code or upload a file to see each problem with its line and rule.

HTML Validator tool

Loading...

Example

Input: The built-in sample: no lang on html, an img without alt, a b element left open inside a p, a center tag, a section inside the open b and a script with type="text/javascript"

Result: 9 errors, 1 warning. First error: <html> is missing required "lang" attribute (line 2, column 2, rule element-required-attributes).

Real output from html-validate 11.16.0 with this tool's settings. The unclosed b element causes several follow-on errors: closing it with </b> drops the count from 9 errors to 4.

Common Messages and How to Fix Them

MessageRuleFix
<img> is missing required "alt" attributewcag/h37Add alt text, or alt="" for decorative images
End tag '</p>' seen but there were open elementsclose-orderClose inner tags such as b before closing the p
<center> is deprecated: use CSS insteaddeprecatedUse CSS, for example text-align: center
<section> element is not permitted as content under <b>element-permitted-contentKeep block elements out of inline ones such as b
"type" attribute is unnecessary for javascript resourcesscript-typeRemove type="text/javascript"
<html> is missing required "lang" attributeelement-required-attributesWrite <html lang="en"> (or your language)
<button> is missing recommended "type" attributeno-implicit-button-typeAdd type="button" or type="submit"

Messages exactly as html-validate 11.16.0 reports them with this tool's settings.

  1. Paste your HTML into the box, or click Upload .html file to load a file from your device.
  2. Click Validate HTML. The first check loads the validator, which takes a moment.
  3. Work through the errors first: each shows the line, column, rule name and the code with the problem highlighted.
  4. Click a rule name to read why it matters and how to fix it.
  5. Review the warnings, then click Copy report to save the full list as text.

Checking HTML Against the Standard

Paste HTML or upload an .html file, and this validator lists every error and warning. Each one comes with its line, column, the rule that flagged it and the code around it. It runs the open-source html-validate library inside your browser, so your code is never uploaded.

html-validate is a linter-style validator. It checks your markup against the rules of the HTML standard, such as which elements may sit inside others and which attributes are required. It also runs accessibility checks and a few best-practice checks. It is not the official W3C checker, and the two do not always agree. For full conformance checking, the reference is the W3C Nu Html Checker at validator.w3.org.

Errors are real problems. Examples are an img element with no alt attribute, a p closed while a b inside it is still open, or an old tag such as center. Warnings are softer advice, such as a script with an unneeded type attribute or a button without a type. Each message links to the rule's own page, which explains why it matters and how to fix it. Copy report gives you every message as plain text.

Why fix markup that browsers display anyway? Browsers quietly guess how to repair broken HTML, and their guesses can shift layouts, break scripts or confuse screen readers. A missing alt text, for example, is both a validation error and an accessibility problem. Valid markup also makes structured data and meta tags easier for search engines to read.

The validator code, about 130 kB compressed, loads the first time you click Validate HTML. The limit is 1 MB of HTML. It checks the markup exactly as you give it, so content added later by JavaScript is not included. To show characters such as < and & as text, the HTML Entity Encoder and Decoder turns them into safe entities. The Meta Tag Generator writes valid SEO and social tags for your head section.

Sources

Frequently Asked Questions

No. This tool uses html-validate, an independent open-source validator that runs in your browser. It follows the rules of the HTML standard and adds accessibility and best-practice checks, but its results can differ from the W3C checker. For example, it treats a missing lang attribute as an error. For an official conformance check, use validator.w3.org.
An error means the markup breaks a rule, such as a missing required attribute, wrongly nested tags or an image with no alt text. A warning is best-practice advice about something that works but is often a mistake, such as a button with no type attribute. Fix errors first, then decide which warnings matter to you.
Not directly. Google has said that valid HTML is not a ranking factor, and most sites have some errors. Broken markup can still cause real problems, though: an unclosed tag can hide content, and errors in the head can stop meta tags or structured data from being read. Fixing errors removes those risks.
Screen readers read the alt text aloud, and browsers show it when the image fails to load, so the HTML standard requires it on almost every image. Describe what the image shows, such as alt="Company logo". For purely decorative images, use an empty value, alt="", so screen readers skip them.
Not directly. Browsers block a page from downloading HTML from other sites, and this tool runs entirely in your browser. Instead, open the page, save it as an .html file and upload it, or copy the source and paste it. For a single-page app, copy the rendered HTML from your browser developer tools.
No. The validator runs in your browser tab. The only download is the validator code itself, the first time you click Validate HTML. Your pasted markup or uploaded file stays on your device, which makes the tool safe to use with private or unreleased pages.

Related Tools

HTML Minifier

Minify HTML by removing comments and collapsing whitespace between tags and inside tags to reduce document size.

Developer Tools

HTML Entity Encode and Decode

Convert special characters to HTML entities and decode HTML entities back to readable text.

Developer Tools

Meta Tag Generator

Generate HTML meta tags for SEO, Open Graph, and Twitter Cards with a live preview of search and social results.

Web and SEO Tools

HTML WYSIWYG Editor

Rich text editor with formatting toolbar that outputs clean HTML. Edit visually and copy the generated code.

Web and SEO Tools

XML Formatter and Prettifier

Format, indent, and validate XML documents with customizable indentation and output options.

Developer Tools