HTML Guides for br
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
In HTML, certain elements are classified as void elements — they cannot contain any content and must not have a closing (end) tag. The <br> element, which represents a line break, is one of these void elements. Others include <img>, <input>, <hr>, <meta>, and <link>.
When the validator encounters </br>, it interprets it as a closing tag for a <br> element. Since void elements are forbidden from having closing tags by the HTML specification, this produces the error "End tag br."
Why this matters
- Standards compliance: The WHATWG HTML Living Standard explicitly states that void elements must not have an end tag. Using
</br>violates this rule. - Browser inconsistency: While most browsers will silently recover from
</br>— some treat it as a<br>, others may ignore it entirely — relying on error recovery behavior is unpredictable and can lead to inconsistent rendering across browsers. - Code clarity: Using
</br>suggests the element has an opening and closing pair, which is misleading to other developers reading the code. It implies a misunderstanding of how the element works.
How to fix it
Replace every instance of </br> with <br>. That's it. There's no need for a closing tag because <br> is self-closing by definition.
Both <br> and <br/> (with a trailing slash) are valid in HTML5. The <br> form is generally preferred in HTML documents, while <br/> is required in XHTML and sometimes used for compatibility with XML-based tools.
Examples
❌ Invalid: using an end tag for <br>
<p>First line</br>Second line</p>
This triggers the "End tag br" validation error.
❌ Also invalid: pairing an opening and closing <br> tag
<p>First line<br></br>Second line</p>
Even when paired with an opening <br>, the </br> end tag is still invalid.
✅ Valid: using <br> without a closing tag
<p>First line<br>Second line</p>
✅ Also valid: self-closing syntax with a trailing slash
<p>First line<br/>Second line</p>
This form is acceptable in HTML5, though <br> without the slash is more conventional in modern HTML.
✅ Practical example: an address block
<address>
123 Main Street<br>
Suite 400<br>
Springfield, IL 62704
</address>
Other void elements
The same rule applies to all void elements. None of these should have closing tags:
<area>, <base>, <br>, <col>, <embed>, <hr>, <img>, <input>, <link>, <meta>, <source>, <track>, <wbr>
If you see a similar "End tag" error for any of these elements, the fix is the same: remove the closing tag.
The <table> element in HTML has a rigid content model. Directly inside <table>, only specific elements are allowed: <caption>, <colgroup>, <thead>, <tbody>, <tfoot>, <tr>, and <script>-supporting elements. Similarly, <tr> elements may only contain <td> and <th> elements. A <br> tag placed between table rows, or directly inside a <tbody> or <tr> but outside a cell, violates this content model.
This error typically happens when developers try to add vertical spacing between table rows using <br> tags. Browsers handle this invalid markup inconsistently — some will push the <br> outside the table entirely, while others may silently ignore it. This leads to unpredictable layout behavior across browsers and can confuse assistive technologies that rely on proper table structure to convey data relationships to users.
The <br> element is only valid inside phrasing content contexts, such as within a <td>, <th>, <p>, <span>, or similar elements. If you need to add spacing between rows, use CSS (margin, padding, or border-spacing) instead of inserting <br> tags into the table structure.
How to fix it
- Remove the
<br>if it was added accidentally or as a formatting attempt between rows. - Move the
<br>inside a<td>or<th>if you intended it to create a line break within a cell's content. - Use CSS for spacing if you need visual separation between rows. Apply
paddingto cells or use theborder-spacingproperty on the table.
Examples
❌ Invalid: <br> between table rows
<table>
<tr>
<th>Item</th>
<th>Description</th>
</tr>
<br>
<tr>
<td>Book</td>
<td>A guide to HTML</td>
</tr>
</table>
❌ Invalid: <br> directly inside a <tr>
<table>
<tr>
<br>
<td>Book</td>
<td>A guide to HTML</td>
</tr>
</table>
✅ Fixed: <br> removed, CSS used for spacing
<tablestyle="border-spacing:01em;">
<tr>
<th>Item</th>
<th>Description</th>
</tr>
<tr>
<td>Book</td>
<td>A guide to HTML</td>
</tr>
</table>
✅ Valid: <br> used inside a table cell
A <br> element is perfectly valid inside a <td> or <th>, where it functions as a line break within the cell's content.
<table>
<tr>
<th>Item</th>
<th>Description</th>
</tr>
<tr>
<td>Book</td>
<td>
Title: HTML & CSS<br>
Author: Jon Duckett
</td>
</tr>
</table>
✅ Fixed: Using padding for row spacing
If your goal is to create visual separation between rows, CSS padding on cells is the cleanest approach:
<style>
.spaced-tabletd,
.spaced-tableth{
padding:1em0.5em;
}
</style>
<tableclass="spaced-table">
<tr>
<th>Item</th>
<th>Description</th>
</tr>
<tr>
<td>Book</td>
<td>A guide to HTML</td>
</tr>
</table>
The <br> element is phrasing content, so it can only appear where phrasing content is expected — inside elements like <p>, <li>, <td>, <span>, and similar text-level containers. Elements such as <ul>, <ol>, <table>, <thead>, <tbody>, <tr>, <select>, and <dl> have restricted content models that only allow specific child elements. Placing a <br> directly inside any of these is invalid HTML.
Browsers may silently move or ignore a stray <br>, but the behavior is inconsistent. Screen readers and other assistive technologies depend on correct document structure to convey meaning. A <br> floating inside a list or table can produce unexpected reading order or layout differences across browsers.
Examples
<br> inside a list
The <ul> element only allows <li> (and <script>/<template>) as children.
<!-- Wrong -->
<ul>
<br>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<!-- Fixed -->
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
If a line break is needed, place it inside a <li> where phrasing content is allowed:
<ul>
<li>123 Main St.<br>Suite 400</li>
</ul>
<br> inside a table
The <table> element only allows <caption>, <colgroup>, <thead>, <tbody>, <tfoot>, and <tr> as children.
<!-- Wrong -->
<table>
<br>
<tr>
<td>A</td>
</tr>
</table>
<!-- Fixed -->
<table>
<tr>
<td>A</td>
</tr>
</table>
<br> used for spacing between blocks
A <br> placed between block-level elements like <div> is technically inside their parent (often <body> or another <div>), so it may not always trigger this specific error. But when it appears in a context that disallows phrasing content, the validator flags it. In either case, CSS margins are the correct way to add spacing between blocks.
<!-- Wrong -->
<div>Section A</div>
<br>
<div>Section B</div>
<!-- Fixed: use CSS margin instead -->
<divstyle="margin-bottom:1rem;">Section A</div>
<div>Section B</div>
<br> outside <body>
A <br> placed between </head> and <body> is stray because only <head> and <body> are valid children of <html>.
<!-- Wrong -->
<!DOCTYPE html>
<htmllang="en">
<head>
<title>Example</title>
</head>
<br>
<body>
<p>Content here.</p>
</body>
</html>
<!-- Fixed -->
<!DOCTYPE html>
<htmllang="en">
<head>
<title>Example</title>
</head>
<body>
<p>Content here.</p>
</body>
</html>
If you see multiple "stray start tag br" errors in a single file, check the parent containers first. Fixing one misplaced parent element often resolves several related errors at once.
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial →Join teams across 40+ countries