Skip to content

HTML Validator

Result —
Errors
—
Warnings
—
Tags read
—
Lines
—

Paste HTML and the validator lists every structural problem with its line number: elements left open, stray or misnested end tags, end tags on void elements such as br, duplicate id values and images with no alt. For example, a span opened inside a div that closes first is reported as 1 error on the span's line.

About this tool

A missing closing div can push a sidebar under the footer, and the browser will never tell you why. This validator reads your markup the way a parser would and lists each structural fault with the line it starts on. It knows the rules in the HTML standard that trip up hand checks: br, img and input never take an end tag, while li, p, td and tr may legally leave theirs out. It also flags duplicate id values, img tags with no alt attribute and obsolete elements like center and font. The check runs in your browser, so template fragments and unpublished pages stay on your machine. It looks at structure only: it does not check which attributes each element allows or which children a table may contain, so it is not a full W3C conformance check.

How to use it

  1. Add your markup

    Paste a full page or a fragment into the box, or open an .html file from your device.

  2. Read the verdict

    The result shows the error count, or No problems found when the structure is clean.

  3. Go to each line

    The table lists every problem with its line number and whether it is an error or a warning.

  4. Fix and recheck

    Edit the markup in the box; the list updates while you type.

Examples

A line break inside a paragraph

HTML markup
<p>Line one<br>line two</p>

Result Result: No problems found
Errors: 0
Warnings: 0
Tags read: 3
Lines: 1

  1. Read 3 tags, skipping comments and the contents of script, style, textarea and title.
  2. Matched each end tag to the nearest open element; void elements such as br and img never need one.
  3. Elements whose end tag the HTML standard lets you omit (li, p, td, tr and others) are not reported as unclosed.

The br element is void, so it needs no closing tag and the snippet passes.

A span left open inside a div

HTML markup
<div> <span>Hello </div>

Result Result: 1 error
Errors: 1
Warnings: 0
Tags read: 3
Lines: 3

  1. Read 3 tags, skipping comments and the contents of script, style, textarea and title.
  2. Matched each end tag to the nearest open element; void elements such as br and img never need one.
  3. Elements whose end tag the HTML standard lets you omit (li, p, td, tr and others) are not reported as unclosed.

The div closes while the span is still open, so the span is reported on line 2.

List items without end tags

HTML markup
<ul><li>One<li>Two</ul>

Result Result: No problems found
Errors: 0
Warnings: 0
Tags read: 4
Lines: 1

  1. Read 4 tags, skipping comments and the contents of script, style, textarea and title.
  2. Matched each end tag to the nearest open element; void elements such as br and img never need one.
  3. Elements whose end tag the HTML standard lets you omit (li, p, td, tr and others) are not reported as unclosed.

The standard lets li end tags be left out, so this list is valid even though it looks unfinished.

How it is calculated

for each tag: open tags push onto a stack; an end tag pops back to its matching open tag; anything skipped that needs an end tag is an error

void elements
area, base, br, col, embed, hr, img, input, link, meta, source, track and wbr, which never have end tags
optional end tags
elements such as li, p, td, tr, option and tbody whose end tag the standard allows you to omit
stack
the list of elements opened and not yet closed, in nesting order

The checker walks through the markup tag by tag. Comments are skipped, and the contents of script, style, textarea and title are treated as text. Each end tag is matched to the nearest open element with the same name. Elements left open between the two are reported unless the HTML standard lets their end tag be omitted. Anything still open at the end is reported the same way. Duplicate ids are errors; a missing alt, obsolete tags and a missing doctype on a full document are warnings.

When not to use it

  • For a formal conformance report on attributes and content models, run the page through the W3C Nu checker as well.
  • JSX, Vue or Blade templates are not HTML, so their component tags and expressions will produce false reports.
  • XHTML served as XML follows stricter rules than the HTML parser rules applied here.

Common mistakes

  • Writing a closing br or img tag, which HTML treats as an error rather than tidy markup.
  • Using self-closing syntax on a div or span, which the browser ignores, leaving the element open.
  • Reusing the same id on several elements, which breaks label links, anchors and getElementById.

Frequently asked questions

Why is a list without closing li tags reported as valid?

The HTML standard lets an li end tag be omitted when the next thing is another li or the end of the list. Browsers close it for you, so it is not an error, although many style guides still prefer explicit end tags.

Is a div written with a slash at the end self-closing?

No. In HTML the trailing slash only means something on void elements, and even there it is ignored. A div written that way stays open until a real closing div, so the checker warns about it.

What is the difference between an error and a warning here?

Errors break the document structure or the standard, such as an unclosed element, a stray end tag or a repeated id. Warnings are allowed by the parser but cause trouble, such as an image with no alt text or an obsolete font tag.

Does it check attribute names and values?

Only id, for duplicates, and alt on images. It does not check whether an attribute is allowed on a given element or whether its value is well formed; the W3C Nu checker covers that.

Can I check a fragment instead of a whole page?

Yes. A fragment needs no doctype, html or body tag. The doctype warning only appears when the markup contains an html element.

How are script and style blocks handled?

Their contents are treated as plain text, so a less-than sign inside JavaScript or CSS is not mistaken for a tag. Only the closing script or style tag is looked for.

Is my markup uploaded?

No. The check runs in your browser, and an opened file is read locally without being sent to a server.

Cite this tool

Using this tool in an assignment, article or report? Copy a citation, or a link for your website.

APA

Tools Directory Editorial Team. (2026, October 18). HTML Validator. Tools Directory. Retrieved October 26, 2026, from https://tools.milunir.com/developer-tools/html-css-and-frontend/html-validator/

MLA

Tools Directory Editorial Team. “HTML Validator.” Tools Directory, 18 Oct. 2026, https://tools.milunir.com/developer-tools/html-css-and-frontend/html-validator/. Accessed 26 Oct. 2026.

Chicago

Tools Directory Editorial Team. “HTML Validator.” Tools Directory. Last modified October 18, 2026. Accessed October 26, 2026. https://tools.milunir.com/developer-tools/html-css-and-frontend/html-validator/.

Link<a href="https://tools.milunir.com/developer-tools/html-css-and-frontend/html-validator/">HTML Validator – Tools Directory</a>