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.
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
<div class="card"> <h2>Title</h2> <p>Read the <span class="tag">docs</p> </div>
<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?
Do <img> and <br> need closing tags?
Is a missing </p> an error?
Why does my layout break far below the unclosed tag?
Check Your HTML Now
Our validator detects this error automatically and shows the exact line number.
Open HTML ValidatorRelated HTML Errors
Incorrect Tag Nesting
Incorrect HTML nesting makes browsers silently rewrite your DOM. Learn the nesting rules and fix p inside p, div inside span, and other broken structures.
Duplicate ID Attributes
A duplicate id breaks JavaScript, anchor links, and screen reader navigation. Learn how to find and fix duplicate id attributes in your HTML the right way.
Missing DOCTYPE Declaration
A missing DOCTYPE forces browsers into quirks mode, breaking your layout. Learn why <!DOCTYPE html> is required and how to fix inconsistent rendering fast.