🆓 Free Forever ⚡ Instant Results

HTML Markup Validator

Validate HTML markup for structure, SEO meta tags, accessibility, deprecated elements, Open Graph, Schema markup, and more — supports URL, source code, and file upload modes.

✓ Free ✓ Fast ✓ No Login Required ✓ Instant Results
Last updated: November 21, 2026
☆ ☆ ☆ ☆ ☆
Supported: .html, .htm, .xhtml

What HTML Validation Means

HTML validation is the process of checking a document against the rules of the HTML specification: a correct DOCTYPE, a single html root element with a language attribute, a head section with a character encoding and a title, a body section for visible content, correctly nested and closed elements, and attributes used according to their definitions. A valid document is easier for browsers to parse consistently, easier for assistive technology to interpret, and far less likely to produce layout or metadata bugs that appear in only one browser.

This validator performs a practical HTML5 audit in three ways: it fetches a live URL, accepts pasted source code, or reads an uploaded .html, .htm or .xhtml file. It checks document structure, SEO metadata (title, meta description, canonical, robots, Open Graph and JSON-LD schema), accessibility signals (image alt text, form labels, heading order and language), obsolete elements, and basic tag balance. Every finding is reported as a passed check, an error or a warning, with a suggested fix where one is needed.

It is important to be clear about scope. This is a fast structural and on-page audit, not the W3C Nu HTML Checker. It uses pattern-based checks rather than a full HTML5 parser, so it catches the problems that most often break rendering, accessibility or search visibility, while a formal conformance validator remains the right tool for exhaustive attribute and parsing validation.

How To Validate HTML Code

  1. Choose an input tab: Validate by URL for a live page, Validate by Code to paste source, or Upload File for an .html, .htm or .xhtml document.
  2. For Validate by URL, enter the full address including https://. The validator fetches the page, follows redirects, and audits the HTML returned by the server with a 20-second timeout.
  3. For Validate by Code or Upload File, provide the complete document - including the DOCTYPE and the html, head and body elements - so the structural checks can run.
  4. Click Validate URL, Validate Code or Upload & Validate. The audit runs immediately and the result appears below the form.
  5. Read the summary first: the score out of 100, the status label, and the counts for passed checks, errors and warnings.
  6. Fix the Errors (red) first. Each entry states the problem and a suggested fix. Then review Warnings (amber), which cover SEO, accessibility and best-practice gaps.
  7. Expand Passed Checks to confirm which tests succeeded, correct the source, and run the validator again. Aim for zero errors, then decide which warnings matter for your page.

How This Validator Audits a Page

The validator runs a set of pattern-based checks and groups the outcome into three buckets. Passed checks confirm that a required element or attribute is present. Errors mark missing essentials such as the DOCTYPE, the html element, the title element, image alt text or the use of deprecated tags. Warnings flag best-practice, SEO and accessibility gaps such as a missing meta description, viewport tag, canonical link, Open Graph tags, structured data, a language attribute or a single clear H1.

The score is a quick health indicator, not a W3C conformance score. It is calculated from the number of passed checks plus half of the warnings, divided by the total number of checks. A page with no errors but several optional SEO warnings can therefore score below 100 even though its markup is structurally sound.

Common HTML Errors to Look For

Most validation failures fall into a small number of patterns. The list below covers the errors this validator reports most often, together with the fix that resolves each one.

  • Missing DOCTYPE declaration - the document does not start with the HTML5 doctype. Fix: add it as the very first line.
  • Missing html, head or body element - the page is a fragment or the wrapper tags were removed. Fix: restore the document skeleton.
  • Missing or empty title element - search results and browser tabs have nothing to display. Fix: add a descriptive title of roughly 50-60 characters.
  • Images without alt text - screen readers cannot describe the image and search engines cannot interpret it. Fix: add descriptive alt text, or an empty alt for purely decorative images.
  • Deprecated elements such as center, font, strike, big, tt, acronym, applet or frame - these are obsolete in HTML5. Fix: replace them with CSS or modern semantic elements.
  • Unclosed common elements - an opening div, section, p, li or table cell has no matching closing tag. Fix: close every non-void element in the correct order.
  • No H1 or multiple H1 elements - the page lacks a single clear main heading. Fix: keep one H1 that describes the page.
  • Form inputs without a label or id - assistive technology cannot associate the control with its purpose. Fix: add a label element with a matching for attribute, or an aria-label.
  • Missing lang attribute on the html element - pronunciation and translation tools cannot tell which language the page uses. Fix: add lang with the correct language code.

How to Fix Missing Tags

A missing tag is usually a structural problem, not a content problem, so the fix is to restore the document skeleton around the content you already have. Start with the DOCTYPE, then the html element with a lang attribute, then a head section, then a body section. Everything visible belongs in the body; metadata, stylesheets and scripts belong in the head.

The example below is the smallest document that passes the structural checks. Use it as a template when a page is missing several wrappers at once.

Minimal valid HTML5 document

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Page title goes here</title>
  <meta name="description" content="A short description of this page.">
  <link rel="canonical" href="https://example.com/page/">
</head>
<body>
  <h1>One clear main heading</h1>
  <p>Page content goes here.</p>
</body>
</html>

If the validator reports an unclosed element, do not simply add closing tags at the end of the file. Close each element where its content actually ends. Nesting matters: a p element cannot contain a div, and a li element must sit inside a ul or ol. Moving the closing tag to the right place is usually faster than debugging the layout later.

For a page assembled from a template, fix the template rather than the published page. Otherwise the same missing tag will reappear the next time the template is rendered.

How to Identify Invalid Attributes

An attribute is invalid when it is not allowed on that element, when its value does not match the expected type, when it is duplicated, or when a required attribute is missing. Common examples include a width or height value written with a unit, a for attribute that points to an id that does not exist, two class attributes on the same element, and a data attribute written without a value.

This validator checks the attributes that affect structure, accessibility and SEO: alt on images, lang on the html element, charset and viewport metadata, label association on form controls, and the presence of canonical, robots, Open Graph and schema markup. It does not compare every attribute against the full HTML5 attribute table. For exhaustive attribute conformance, run the page through the W3C Nu HTML Checker after this audit.

  • Width and height on images take unitless numbers: width="600", not width="600px".
  • The for attribute on a label must exactly match the id of the form control it describes.
  • Do not repeat the same attribute on one element; combine multiple classes into a single class attribute.
  • Custom data attributes must start with data- and must have a value, for example data-id="42".
  • Use an empty alt for decorative images and descriptive alt text for images that convey information.
  • Do not put an href on a non-link element; use an a element with a real URL for navigation.
  • Prefer modern attributes over presentational ones: use CSS for alignment, spacing, borders and colours instead of obsolete attributes.

HTML5 Validation Examples

The quickest way to understand validation is to compare a broken snippet with its corrected version. The examples below show the same content before and after the fixes this validator recommends.

Before: deprecated elements and missing accessibility details

<div>
  <center><font color="red">Welcome to our store</font></center>
  <img src="hero.jpg">
  <input type="text" placeholder="Your email">
</div>

After: HTML5 structure, alt text and a labelled input

<div>
  <h1 style="color: #b91c1c; text-align: center;">Welcome to our store</h1>
  <img src="hero.jpg" alt="Storefront with seasonal displays">
  <label for="email">Email address</label>
  <input type="email" id="email" name="email" placeholder="you@example.com">
</div>

Before: metadata and document structure missing

<html>
<body>
  <h2>Our services</h2>
</body>
</html>

After: doctype, language, charset, viewport and one H1

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Our services - Example Store</title>
</head>
<body>
  <h1>Our services</h1>
</body>
</html>

How to Interpret Validation Results

The summary gives you four numbers: passed checks, errors, warnings and total checks, plus a score out of 100 and a status label. The status label is based on the error count: zero errors is reported as Valid HTML, one to four errors as Minor Issues, five to fourteen as Moderate Issues, and fifteen or more as Major Issues. Warnings do not change the status, but they do lower the score because the score counts each warning as half a passed check.

Treat errors as blockers and warnings as a prioritized backlog. A missing DOCTYPE, a missing title, missing alt text or a deprecated element should be fixed before publishing. A missing meta description, Open Graph tag, canonical link or schema block is a real improvement but may be optional for a private page or an internal tool. The goal is not a perfect score for its own sake; it is a page that renders predictably, is accessible, and exposes the metadata search engines need.

Some findings need human judgment. The tag-balance check counts opening and closing tags for common elements, so an optional end tag such as a p or li element can be reported as unclosed even when the markup is valid. Open the reported location and confirm whether the element is intentionally left open. If it is, the warning is a false positive; if the content after it is being pulled into the wrong container, add the closing tag.

  • Passed: the check found what it was looking for.
  • Error: a required structural or accessibility detail is missing, or an obsolete element is in use. Fix before publishing.
  • Warning: a best-practice, SEO or accessibility improvement. Review and prioritise.
  • Score: passed checks plus half of the warnings, divided by total checks, multiplied by 100.
  • Status: based on the number of errors, not on the score alone.

Benefits of Using This HTML Validator

  • Runs the structural checks that matter most in one pass: DOCTYPE, html, head, body, title, charset, viewport and language.
  • Audits SEO metadata, including title length, meta description, canonical, robots, Open Graph and JSON-LD schema.
  • Checks accessibility signals such as image alt text, form labels and heading structure.
  • Flags obsolete elements such as center, font, strike and frame with modern HTML5 replacements.
  • Reports unclosed common elements so layout bugs are caught before they reach production.
  • Supports three input modes: a live URL, pasted source code or an uploaded HTML file.
  • Shows a suggested fix for every finding and lists passed checks separately, so you can confirm what is already correct.
  • Free to use with no account, no installation and no software to maintain.

Best Practices

  • Validate the complete document, not a fragment, when you are checking structure.
  • Fix errors first, then work through warnings in order of SEO or accessibility impact.
  • Re-run the validator after each batch of fixes and compare the counts.
  • Use the W3C Nu HTML Checker for strict conformance and this audit for practical SEO and accessibility checks.
  • Fix the template or component, not only the published page, so the same issue does not return.
  • Do not chase a perfect score blindly; some warnings are optional for private or internal pages.
  • Keep a copy of the corrected markup as a reference for future pages.

Practical Examples

Missing alt text on a product page

The validator reports that 3 of 8 images are missing alt attributes. Add descriptive alt text to the product and lifestyle images, use an empty alt for the decorative divider, then re-run the audit and confirm the error count drops to zero.

An old page built with center and font

The deprecated-tags check lists center and font. Replace the center element with CSS text-align: center, move colour and size into a stylesheet, and keep the content unchanged.

A landing page with no metadata

The audit warns about a missing meta description, canonical link and Open Graph tags. Add a 150-160 character description, a self-referencing canonical URL, and og:title, og:description and og:image.

A template with two H1 elements

The heading check reports two H1 elements. Keep the page title as H1 and demote the section title to H2, then check that the heading order still reads logically.

A URL that cannot be fetched

The URL mode returns Cannot fetch URL content when the server blocks automated requests or responds with an error. Use Validate by Code or Upload File with the same HTML to continue the audit.

Who Should Use This Tool

  • Web developers checking markup before a release or deployment.
  • SEO specialists auditing titles, meta descriptions, canonicals, Open Graph tags and structured data.
  • Content editors verifying image alt text and heading structure before publishing.
  • QA teams validating templates and reusable components.
  • Students learning the structure of a valid HTML5 document.
  • Agencies running a quick markup audit across client sites.

Frequently Asked Questions

Is this the same as the W3C HTML validator?

No. The W3C Nu HTML Checker performs full conformance validation against the HTML5 specification. This tool performs a practical structural, SEO and accessibility audit and is designed to be faster and easier to read. Use both when you need strict conformance plus on-page checks.

What does the Valid HTML status mean?

It means the validator found no errors in its checks: the DOCTYPE, html element, title and other required essentials are present, images have alt attributes, and no deprecated elements were detected. It does not mean every optional SEO warning has been resolved.

Why does it report my p or li element as unclosed?

The tag-balance check counts opening and closing tags for common elements. HTML allows optional end tags for elements such as p and li, so a valid document can still trigger this warning. Check the reported element manually; if the content is nested correctly, the warning is a false positive.

What is the difference between an error and a warning?

An error marks a missing structural or accessibility essential, such as the DOCTYPE, the html element, the title element, image alt text or a deprecated element. A warning marks a best-practice, SEO or accessibility improvement, such as a missing meta description, canonical link, Open Graph tag or structured data.

Does validating HTML improve SEO?

Clean markup helps search engines parse the page and reduces the chance that metadata or content is missed, but validation is not a direct ranking factor. The SEO value comes from the checks it surfaces: a descriptive title, a meta description, a canonical URL, structured data and accessible images.

Can I validate a live URL instead of pasting code?

Yes. Use the Validate by URL tab. The validator fetches the page, follows redirects and audits the HTML returned by the server. If the server blocks automated requests or returns an error, paste the source or upload the file instead.

Are my files or source code stored?

No. The audit runs in your browser session and the result is displayed on the page. As with any online validator, avoid submitting confidential production code if you are not comfortable doing so.

Which HTML version does it check?

The checks target HTML5: the HTML5 DOCTYPE, the lang attribute, charset and viewport metadata, semantic elements and the current list of obsolete elements. Older XHTML-specific syntax is not treated as a requirement.

Why are missing image alt attributes counted as errors?

Alt text is required for accessibility and is also used by search engines to understand images. The validator counts each image without an alt attribute as an error so the issue is not buried among optional warnings. Use an empty alt for purely decorative images.

Why does multiple H1 get a warning?

A single H1 gives the page one clear main topic. Multiple H1 elements are valid HTML5, but they can make the document outline ambiguous, so the validator recommends one H1 and H2 or H3 elements for subsections.

Can I validate only part of a page, such as a component?

You can paste a fragment, but structural checks such as the DOCTYPE, html, head and body elements will then fail by design. For a component, validate it inside a complete test document.

Does a 100/100 score mean the page is fully W3C-compliant?

No. The score reflects the checks this tool runs, not the full HTML5 grammar. A page can score 100 here and still have an attribute or nesting issue that only the W3C Nu HTML Checker would detect.

User Reviews

No reviews yet. Be the first to review!

Write a Review

☆ ☆ ☆ ☆ ☆
We Value Your Privacy

We use cookies to improve your browsing experience, analyze traffic, and display relevant advertisements.