An HTML validator reads your markup and points out the mistakes: a tag you forgot to close, an id you used twice,
an image with no alt text. Paste your code into the editor, and the results list any problems this checker finds,
with a line and column for each one.
“But my page looks fine!” Sure, because browsers are very forgiving. When your HTML is broken, the browser quietly
guesses what you meant and keeps going. The guess is often right, until it isn’t. A missing </div>
that did nothing today can swallow your footer tomorrow. Clean HTML also matters beyond the layout: screen readers
depend on it (alt text, proper links and buttons), and search engines read your <title>,
headings and structure to understand the page.
Everything runs right here in your browser. Your code isn’t uploaded anywhere.
Five quick steps, with common mistakes to try. Paste a “before” example into the validator and see what it says.
Step 1 Paste or Open Your HTML
Get some HTML into the editor on the left. Pick whichever is easiest:
- Paste it: copy HTML from your code editor, a CMS, an email template or anywhere else.
- Open a file: click the upload button, or just drag your .html file onto the editor.
- Click Sample: loads a small page with a few mistakes hidden in it. Can you fix them all?
There’s no Check button. The results update a moment after you stop typing, so you can fix something and watch
the problem disappear.
💡 A snippet like <p>Hi</p> is checked as a piece of a page. Add
<!DOCTYPE html> or an <html> tag and it’s checked as a full page, with
extra checks for the doctype, the <title> and the language.
Step 2 Read the Results and Jump to Each Problem
Every problem shows a red error or amber warning badge, where it is (line and
column), what’s wrong in plain English, and the name of the rule. Click a problem and the validator selects that
line in the editor, so you don’t have to hunt for it. Start at the top: one unclosed tag can cause the errors
that come after it.
Example: a tag that’s never closed
❌ Before:
<div class="card">
<h2>Pricing</h2>
<p>Only <strong>$5 a month</p>
</div>
✅ After:
<div class="card">
<h2>Pricing</h2>
<p>Only <strong>$5</strong> a month</p>
</div>
The validator says: “<strong> is opened but never closed. Add </strong> before </p>.”
That would close the tag, but “a month” would be bold too. Only the price should be bold, so put
</strong> right after $5. Leave it out and the bold can carry on into the
next paragraph.
Step 3 Fix the Errors First
Errors can break part of your page or leave out something it needs, so they come first. Two common ones are
duplicate ids and duplicate attributes. Use each id once. If two buttons share id="save",
getElementById only finds the first one, while #save in your CSS styles both. And
when an attribute appears twice on one tag, the browser only keeps the first one.
Example: duplicate id and duplicate class
❌ Before:
<button id="save" class="btn">Save</button>
<button id="save" class="btn" class="primary">
Save all
</button>
✅ After:
<button id="save" class="btn">Save</button>
<button id="save-all" class="btn primary">
Save all
</button>
💡 Need more than one class? Put them in a single attribute, separated by spaces: class="btn primary".
Step 4 Don’t Skip the Warnings
Some warnings are only about style, like single quotes around a value. Others can affect your page. For
example, <div /> doesn’t close the div, so it can swallow what comes next. Use the
Errors / Warnings filter to look at them on their own.
Two warnings to look for are an image without alt text (people using a screen reader can miss what it shows)
and an <a> without an href. It isn’t a real link, so the Tab key normally skips
it. For more checks like these, try the HTML Accessibility Checker.
Example: missing alt text and a fake link
❌ Before:
<img src="team.jpg">
<a onclick="openMenu()">Menu</a>
✅ After:
<img src="team.jpg" alt="Our team at the summer meetup">
<button type="button" onclick="openMenu()">Menu</button>
💡 Purely decorative image? Use an empty alt="". Screen readers will skip it, and the warning goes away.
Step 5 Check the Full Page
When you paste a whole page, you also get the page-level checks: the <!DOCTYPE html> line (without
it, browsers fall back to an old “quirks mode”), a <title> for the browser tab and search
results, a lang attribute for screen readers, and scripts in <head> that can
delay the page. A script file with defer won’t hold up the page while it downloads.
Example: a page missing the basics
❌ Before:
<html>
<head>
<script src="app.js"></script>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
✅ After:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello</title>
<script src="app.js" defer></script>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
Here’s what you can do next:
- Still have broken tags? Try the HTML Fixer, then check its changes before you use them.
- Check the rest: use the CSS Validator for your styles and the JavaScript Validator for your scripts.
- Tidy it up: run it through the HTML Formatter for clean, consistent indentation.
- See it: paste it into the HTML Viewer to check how it looks on phone, tablet and desktop.
- Keep building: add CSS and JavaScript in the HTML Editor with a live preview.
This checker isn’t the official W3C validator, and the two can give different results. If you need to check
your page against more HTML rules, use the W3C Markup Validation Service too.
Is this the same as the W3C validator?
No. This isn’t the official W3C validator, and the two can give different results. This checker runs in your browser as you type and looks for common problems, like unclosed tags, duplicate ids, missing alt text and a missing <title>. The W3C Markup Validation Service (validator.w3.org) is a separate tool that checks many more HTML rules. If your page needs to pass the W3C check, run it there too.
Does “No problems found” mean my HTML is valid?
Not always. It only means your code passed this tool’s checks. It can still have mistakes the tool doesn’t look for. For example, it won’t catch a misspelled tag like <buton>Order coffee</buton>, or scr instead of src in <img scr="cat.jpg" alt="My cat">. It also won’t warn you about an <li> outside a list. Preview the page and try its links and buttons. For more checks, use the W3C validator too.
What’s the difference between errors and warnings?
Fix errors first. They include a <div> that’s never closed, an id used twice, or a full page with no <title>. Read the warnings too. Some are only about style, like a tag name in capitals. Others can affect your visitors, like missing alt text or a <div> inside a <p>. Use the All / Errors / Warnings filter to focus on one kind at a time.
Is my HTML uploaded anywhere?
No. The checks run right here in your browser, so your code never leaves your computer. You can even disconnect from the internet after the page loads and it keeps working.
How do I fix “never closed” errors?
Click the issue to jump to the tag that was opened, then find where that element should end and add the closing tag there, like </div>. If the code is hard to follow, run it through the HTML Formatter first. With proper indentation, a missing closing tag is much easier to spot. Fix the first one and re-check, because one missing tag often causes the errors after it.
Does it check my CSS and JavaScript?
No. It checks the HTML only. Anything inside <style> and <script> tags is skipped, so a < in your JavaScript won’t be reported as a problem. To check that code, copy it into our CSS Validator or JavaScript Validator.
Why doesn’t it complain about a missing doctype or <title> in my snippet?
On purpose. If your code has no <!DOCTYPE html> and no <html> tag, it’s treated as a snippet, like a piece of a page, and the page-level checks are skipped. As soon as you add either one, it’s checked as a full page, and the doctype, <title>, lang and head script checks switch on.
My page looks fine in the browser. Why does it show errors?
Because browsers are very forgiving. They quietly guess what you meant and fix the markup for you. The guess is often right, but not always. A tag that’s never closed might look fine today and break the layout when you add the next section. Fixing errors helps avoid surprises like that, but check the page again afterwards.