What validation checks

The HTML Living Standard describes which elements can go inside others and which attributes those elements can have. A validator, also called a conformance checker, tests the markup it receives against rules like these. It can report an li outside a list, an attribute it does not recognize, or a value where the standard requires a different format. It can also spot two elements with the same id in one document. Then an in-page link or a label may not point to the element you meant.

Try this short page to see why opening a file is a different check from validating it. Save it as hours.html and open it in a browser, then paste the full document into a checker.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Library hours</title>
</head>
<body>
  <main>
    <h1>Library hours</h1>
    <p>Pick a day:
      <ul>
        <li>Tuesday: noon to six</li>
        <li>Saturday: ten to four</li>
      </ul>
    </p>
  </main>
</body>
</html>

You can see the hours in the browser even though a paragraph cannot contain a ul. The HTML parsing rules end the paragraph when the list starts. The final </p> no longer closes the paragraph you wrote. The checker can point at that closing tag even though the mistake began earlier. Move </p> to the end of the line with "Pick a day:" and validate the page again. The list should still appear in the browser. The checker should no longer complain about an unmatched paragraph end tag.

A checker can find a missing attribute in a plain case, such as an image with no alt. It cannot judge whether the replacement text is useful. It also cannot tell you whether a booking link leads to the right form. It cannot judge whether text is readable on a phone or whether a visitor can finish the form with a keyboard. Keep those tasks on the test list after validation passes.

The validators worth using in 2026

Start with the Nu HTML Checker for pages written to the HTML Living Standard. To check a small example, paste the full HTML document into the text input. Choose file upload if you already saved an HTML file. Use the address option for a public page the checker can fetch. For the library example, check both versions with the same input method so the only difference is where the paragraph closes.

The address option checks the response the service gets. That may not match what you see when you are signed in. If the result mentions a title or a form you do not recognize, check the URL. It may redirect to a sign-in page or a generic error page. For private pages, use a local checker approved for that material instead of sending the markup to a public service. Even a page meant only as a preview may contain names or links that should stay private.

Nu can also run locally as vnu.jar, distributed by the Nu HTML Checker project. With Java installed and the checker JAR in your current directory, run this on the saved example:

java -jar vnu.jar hours.html

Use the local option again when you need to check a batch of generated pages without uploading them. If a build uses a different version than the one behind the web interface, compare the rules and tool versions. Their reports may not match word for word. If you must check a document against an old doctype such as HTML 4.01 Transitional, use the W3C Markup Validation Service in that legacy mode. A result under old rules answers a different question from whether the same page meets today's HTML requirements.

Errors that matter vs noise

Start with the first error that can change how the browser reads the rest of the document. A stray closing tag or a missing quotation mark can make later messages look unrelated. This is worse when a shared header sits above all the page content. Read the lines before and after the position in the report, fix one suspected cause, and run the checker again. If several later errors disappear together, you can leave their lines alone.

After parsing errors, fix problems that can change what people read or click. If two forms include id="email", give the fields distinct IDs. Update the for attributes on their labels. Also update any code or links that use those IDs. If you find a button wrapped inside a link, give each action one control. A link can take the reader to the booking page, where a submit button can send the completed form. If both actions are needed, give them separate controls with names that make the difference clear.

Read warnings in context. A warning about the trailing slash in <img src="shelf.jpg" alt="" /> does not mean the browser treats the image as unclosed. img is a void element, which has no end tag in HTML. Use <img src="shelf.jpg" alt=""> for plain HTML if you want to avoid that warning. If an attribute value is unquoted and the slash is attached to it, the slash can become part of the value. Check the source before you dismiss the warning.

The site's opening checklist from the 2007-2009 archive includes validation work for its mailing list pages. In the original mailing list discussion, contributors distinguished rules a checker can apply from requirements that need human judgment. Use the current checker and standard when deciding whether a report on a new page needs action. Older documents make useful comparisons. But their markup and the rules it was written for may differ from yours.

Validating AI-generated HTML

Check the complete output after you have placed it in your project. A generator might return a bare fragment, which can be right for a component. It might instead return a full page with html, head, and body. A full page does not belong inside an existing page template. A card can look fine on its own. It can still produce duplicate IDs when the same card appears six times on a page. Validate the assembled page so the checker can see those interactions.

Ask the tool for a small fix to the specific source of an error. For instance, if the booking card repeats id="slot", ask for unique IDs with matching for attributes for each date selector. Read the diff to make sure it did not remove the visible labels to silence a message. Then build the page again and click each label to check that it focuses its own field.

Review text that a generator supplies to satisfy required markup. An empty alt is right for a purely decorative image. It is not a fix for a photo or diagram that carries information the page does not give elsewhere. If the generated text says only "photo," decide what the picture contributes to the reader's task before rewriting it. Use the alt text best practices guide to work through that decision.

Validation in your workflow

For a hand-written page, save it, run the checker, and fix errors before you rely on what you see in the browser. For a site built from templates, point the checker at the generated HTML once the build has filled in the template's placeholders. Start with one page per template, including a version with real lists, images, or form fields if the template can render those. A mostly empty example may never exercise the code that produces invalid markup.

In continuous integration, run the checker after the build so new pages and template changes are checked before publishing. Choose a policy that blocks new errors and sends warnings to review instead of hiding the entire report. When a shared component causes the same error on dozens of pages, correct the component and rebuild. Editing each generated file leaves the cause in place for the next build. If a script adds markup after the page loads, the first HTML check will not see it. Test the affected state in the browser too.

Finish by navigating without a mouse, following the important links, and trying the form with both a valid and an incomplete entry. A passing workflow means the chosen pages have no validation errors. You have reviewed the remaining warnings. The page still works when you try the tasks visitors came to do. Find another practice page in the Learn HTML hub and try the same checks there.