HTML Validator for Unclosed Tags and Bad Nesting

Paste a page or a fragment. Each unclosed tag, stray end tag, duplicate id, or missing alt comes back with a line number. Browsers repair these faults in silence, so the page looks fine while the source stays broken.

Markup input and validation report

Ctrl+Enter runs the check. After the first run, the report refreshes as you type. Your markup stays in this tab.

Report

    Click any row in the report. The cursor lands on the faulty line, with the line selected. Red and amber numbers in the gutter mark the same lines, so a long template shows where the trouble clusters before you read a single message.

    What the browser builds from a broken paste

    Here is a paragraph with a div inside. Left, the source. Right, the tree a browser builds from the source, as DevTools shows under Elements.

    Source you wrote
    <p class="lead">Three fixes went live.
      <div class="note">Staging moved.</div>
    </p>
    Tree the browser builds
    <p class="lead">Three fixes went live.
      </p>
    <div class="note">Staging moved.</div>
    <p></p>

    A p holds phrasing content only. The parser ends the paragraph the moment <div> opens. The later </p> has nothing left to close, so the parser builds a new, empty paragraph from the tag.

    Two effects follow. Styles on .lead stop before the note. An empty paragraph with its own top and bottom margin appears under the note, and the gap looks like a CSS bug. The console stays silent.

    The checker reads your source, not the repaired tree. The report names line 3, the stray </p>, and points back to the div on line 2 as the cause.

    Rules the checker applies

    Two levels. An error breaks a parsing rule or a nesting rule from the HTML spec. Browsers repair errors, and the DOM ends up different from your file. A warning marks obsolete markup, a likely typo, or a missing document detail. Warnings change nothing about how the page parses.

    Rule Level Trips on What the browser does
    Element never closedError<section> with no end tagCloses the section at the end of the file. Every later block lands inside.
    End tag skips an open childError<li><span>text</li>Closes the span at the </li>. Span styles bleed to there.
    Stray end tagError</div> with no open divDrops the tag. A stray </p> turns into an empty paragraph.
    Block inside a paragraphError<p> holding a div, ul, table, or heading, reported at the </p>Ends the paragraph before the block.
    Link inside a linkError<a> opened before the first </a>Ends the outer link at the inner one.
    Interactive inside a link or buttonErrorA button, input, select, or textarea inside <a>Keeps both. Click targets and tab order differ per browser.
    Heading inside a headingError<h2><h3>Closes the outer heading first.
    End tag on a void elementError</br>, </img>, </input>Reads </br> as a second line break. Drops the rest.
    Duplicate attributeErrorclass="lead" class="intro"Keeps the first value. The intro class never applies.
    Duplicate or broken idErrorThe same id twice, an empty id, an id with a spacegetElementById and #top links stop at the first match.
    img with no alt or srcError<img src="logo.png">Shows the image. Screen readers read the file name aloud.
    Unclosed comment, quote, script, or tagError<!-- todo with no -->Swallows the rest of the file into the comment or value.
    Missing doctype or titleErrorFull documents onlyNo doctype means quirks mode. Box sizing and table fonts change.
    Slash on a normal elementWarning<div/>Ignores the slash. The div stays open.
    Obsolete element or attributeWarning<center>, <font>, bgcolor, alignStill renders. The report names the CSS replacement.
    Unknown elementWarning<buton>, <titel>Treats the tag as a plain inline box. Names with a hyphen pass as custom elements.
    Misplaced list, row, or optionWarning<li> in a div, <td> outside a rowBuilds the missing parent or moves the element.
    Content inside headWarningA div before <body>Ends the head early. Meta tags after the div land in the body.
    label pointing nowhereWarningfor="email" with no matching idA click on the label focuses nothing.
    No lang, no charsetWarningFull documents onlyScreen readers guess the language. Encoding falls back to a sniff.

    Optional end tags count as valid. <li>one<li>two, a paragraph closed by the next paragraph, and table cells with no </td> all pass, because the spec allows them. A slash on a void element such as <br/> also passes.

    The sample, fault by fault

    Load sample fills the box with a release-notes page for toolexe.com, 29 lines long. Every fault below sits there on purpose. Run the check, then match the report against this list.

    1. Line 2The html tag has no lang. A warning, since the page still parses.
    2. Line 9The logo img has no alt. A screen reader announces "logo dot png" inside a link, which tells nobody where the link goes. Here the fix is alt="Toolexe home", not an empty alt, because the image is the only content of the link.
    3. Line 11id="top" on main repeats the header id from line 8. The #top link on line 19 scrolls to the header.
    4. Line 13Two class attributes. The paragraph gets lead, never intro.
    5. Line 15The stray </p> from the demo above, caused by the div on line 14.
    6. Line 18The muted span never closes. The report anchors on the span, then names the </li> where the browser cuts the span off.
    7. Line 19A link to #top sits inside the link to the beautifier. The second </a> closes nothing in the browser tree.
    8. Line 21Two faults on one line. The center tag is obsolete, a warning. The </br> is an error, and the browser renders the pair as two line breaks.
    9. Line 23The label points at email. The input id is work-email. The name attribute matches, so the form posts fine, but a click on the label does nothing. The name never counts for a label.

    Fix line 14 first. Move the note outside the paragraph and the error on line 15 disappears with the fix. One early fault often produces the later ones, so the report sorts by line and the top row deserves the first look.

    Full document or fragment

    A fragment is a Blade partial, a CMS body field, an email block, a component template. A fragment has no doctype, title, lang, or charset, and should not. Fragment mode skips those four rules.

    Auto detect switches to full document once the paste holds a doctype or an html tag. Pick a mode by hand when auto guesses wrong, for example a partial with an html tag inside a code sample.

    Where this checker stops

    The rules above run against the source in a single pass. A few classes of fault sit outside the pass.

    Before a launch, run the rendered page through the W3C Nu validator. Nu applies the full spec, attribute grammars included. Expect a slower round trip and a longer report. This page suits the edit loop: paste, fix line 14, check again.

    For nesting faults spread across hundreds of lines, run the markup through the HTML beautifier first. Indentation drifts right at an unclosed element, so the fault becomes visible by eye. Then come back here for the line number.

    Questions after the first report

    Silent browser repairs, self-closing slashes, alt text, cascading errors, privacy, and templates.

    Why does my page look fine when the report lists errors?

    Browsers repair broken markup before painting. An unclosed span closes at the next end tag, a stray </p> becomes an empty paragraph. The repaired tree often renders close to what you meant. The faults show up later, as a stray margin, a style bleeding into the next block, or a script finding the wrong element.

    Does <br/> count as an error?

    No. A slash on a void element such as br, img, input, or meta is allowed and ignored. A slash on a div or span is a warning, because the parser ignores the slash there too and the element stays open.

    Why is a missing alt an error, not a warning?

    The HTML spec requires alt on every img. A decorative image takes alt="" with nothing inside the quotes, which passes. An image inside a link with no other text needs a real description of the link target.

    One missing end tag gave me five errors. Why?

    A single unclosed element shifts every later end tag. Fix the first error in the report, run the check again, and most of the rest often disappear. The report sorts by line for this reason.

    Is my markup sent to a server?

    No. The checker runs as JavaScript in this tab. Nothing gets uploaded or stored. Clear empties the box, and a refresh does the same.

    My Vue or Blade template shows unknown elements.

    Component tags such as <Card> or <x-alert> come from your framework, not from HTML. Names with a hyphen pass as custom elements. Names without one get a warning. Validate the HTML your framework renders, from View Source, for an accurate report.