Loading HTML Validator...
Please wait a moment

How to Validate HTML - Step by Step Guide

Step 1

Input Your HTML Document

Start by entering your HTML document into the validator. Whether you're validating code from our HTML editor or Word to HTML converter, you can paste content, upload files, or use sample data.

•
Paste HTML content: Copy HTML from web pages, templates, or applications
•
Upload HTML files: Select .html or .htm files from your computer for validation
•
Use sample HTML: Click "Sample" to load example HTML for testing the validator

Example: Valid HTML Document

Here's a well-formed HTML5 document that will pass validation:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>My Page</title>
</head>
<body>
  <h1>Hello World</h1>
</body>
</html>
Step 2

Review Validation Results

A moment after you stop typing, the validator shows the first problem with its line and column - or, if there is none, the document statistics and any missing alt text. After validation, use our HTML beautifier to format the code properly.

•
Structure check: Unclosed and mismatched tags, stray closing tags, duplicate ids and nesting the browser would repair. For content-model rules, use the W3C Nu HTML Checker
•
Error reporting: The first problem, with its line, column and a plain explanation
•
Accessibility warnings: Alerts for missing alt attributes and best practice violations
•
Document statistics: Information about elements, attributes, and structure depth

Common HTML Issues Detected:

❌ Unclosed tags: Missing closing tags for elements

<div><p>Text</div> // Missing </p>

⚠Missing alt attributes: Images without alt text for accessibility

<img src="photo.jpg"> // Should have alt="..."

❌ Paragraph around a block: the browser ends the <p> at the <div>, so the </p> is left with nothing to close

<p><div>Text</div></p> // Use <div> instead of <p>
Step 3

Fix Issues and Download

If validation errors or warnings are found, use the detailed feedback to fix issues. Once validated, you can convert to PDF, minify for production, tidy it with the HTML Formatter, preview it in the HTML viewer, or download your HTML document.

•
Issue identification: Clear descriptions of what needs to be fixed
•
Helpful warnings: Best practice recommendations for better HTML
•
Re-checks as you edit: the result updates a moment after you stop typing
•
Download option: Save your validated HTML file

Frequently Asked Questions

What does this HTML validator check?

It reads your markup the way a browser does and stops at the first real problem: a tag, comment, attribute quote or <script>/<style>/<textarea>/<title> block that is never closed, a closing tag that does not match what is open, a closing tag with nothing to close, an element left open at the end, the same id used twice, an attribute repeated inside one tag, and nesting the browser would quietly repair - an <a> inside another <a>, nested headings, <div/> written as if it closed itself, or a </p> after a block element has already ended the paragraph. Each problem comes with its line and column.

Will it complain about normal HTML5 shortcuts?

No. Void elements like <br>, <img> and <input> without a slash are fine, and so are left-out end tags that HTML allows (</li>, </p>, </td>, </tr>, </option> and friends), unquoted attribute values, boolean attributes like disabled or checked, custom elements such as <my-widget>, and self-closing <path/> or <circle/> inside SVG.

What does it not check?

It does not know which elements are allowed inside which (a <div> inside a <span>, say), whether attribute names and values are valid, or anything about CSS and JavaScript. For that kind of full standards check, run your page through the W3C Nu HTML Checker at validator.w3.org/nu. This page is the quick first pass that catches the mistakes which actually change how the page is built.

Why does it say my </p> has nothing to close?

A paragraph cannot contain block elements such as <div>, <ul> or <table>. When the browser meets one inside a <p>, it ends the paragraph right there, so the </p> you wrote later has no open paragraph left. Swap the <p> for a <div>, or move the block element out of the paragraph.

What are the warnings under the statistics?

They are hints, not errors. At the moment the only one is an <img> without an alt attribute: screen readers need it, and alt="" is the right value for purely decorative images.

Is my HTML sent to a server?

No. The check runs in your browser and nothing you paste or upload leaves your computer. Your markup is also never rendered on this page, so scripts inside it do not run.

Can it fix the errors for me?

No, it only points at them. Once the markup is clean, the HTML Formatter can tidy the indentation and the HTML Viewer shows how the page renders.