</>
ValidateHTML

Unclosed HTML Tag

An unclosed tag occurs when an opening HTML tag like <div>, <span>, or <section> is missing its corresponding closing tag. Browsers try to auto-close tags, but the results are unpredictable. Content can be swallowed, layouts break, and styles bleed into wrong sections.

Find this error in your own code. Paste your HTML or enter a URL, free and instant.Open the validator
16.1%
of sites tested

How common is this error?

We ran this validator over the home page of the Tranco top 5,000 websites in August 2026. 428 of the 2,656 sites we could reach hit it. That makes it the 12th most common HTML problem we found, across 6,325 occurrences. See the full study.

Most frequent wording: Stray end tag '</tr>'

Why It Matters

Unclosed tags are one of the most common causes of broken layouts. A single unclosed <div> can shift your entire page structure. Screen readers also depend on proper tag closure to navigate content correctly.

Common Causes

  • Forgetting the closing tag on container elements like <div> and <section> that wrap large blocks of content.
  • Copy-pasting a snippet that included the opening tag but not its matching close.
  • Treating an element like <span> or <a> as self-closing, when only void elements such as <img>, <br>, and <input> can omit the close.

Code Examples

Invalid
<div class="card">
  <h2>Title</h2>
  <p>Read the <span class="tag">docs</p>
</div>
Valid
<div class="card">
  <h2>Title</h2>
  <p>Read the <span class="tag">docs</span></p>
</div>

How to Fix

  • 1Use an HTML validator to find the exact line where the unclosed tag starts.
  • 2Work from the innermost unclosed tag outward. Fix nested issues first.
  • 3Use an editor with bracket matching (VS Code highlights matching tags).
  • 4Self-closing tags like <img>, <br>, <input>, and <hr> do not need a closing tag.

Frequently Asked Questions

How do I find which tag is unclosed?
Run your markup through an HTML validator: it reports the line where the unclosed element starts. In your editor, place the cursor on the opening tag; VS Code and most editors highlight the matching close, or show nothing when it is missing.
Do <img> and <br> need closing tags?
No. Void elements (<img>, <br>, <input>, <hr>, <meta>, <link>) never take a closing tag in HTML5. Writing <img></img> is incorrect. Elements like <div>, <span> and <a> do have to be closed.
Is a missing </p> an error?
No, and this catches people out. The HTML standard lets you omit </p> when the paragraph is followed by another block element (<p>, <div>, <ul>, <h2> and many more) or when nothing else remains inside its parent. So <div><p>Hello</div> is valid HTML and our validator accepts it. The same allowance covers </li>, </tr>, </td>, </option> and a handful of others. Closing them anyway is a good habit for readability, but leaving them out is not a spec violation.
Why does my layout break far below the unclosed tag?
The browser auto-closes the missing tag at an unpredictable point, often the end of the parent or document. Everything between the opening tag and that guessed close gets absorbed into the element, so the visible break appears far from the actual mistake.

Check Your HTML Now

Our validator detects this error automatically and shows the exact line number.

Open HTML Validator

Related HTML Errors

← View all HTML errors