The <br> tag inserts a line break:
<p>First line<br>Second line</p>
The text breaks at the <br> but stays in the same paragraph. This differs from using multiple <p> tags, which create separate blocks with spacing.
Self-Closing Syntax
The <br> tag is void—it has no content or closing tag. In HTML5, write it as:
<br>
XHTML required the self-closing slash:
<br />
Both work in modern browsers. HTML5 doesn't require the slash, but including it doesn't hurt. Most linters accept either.
br vs p: Semantic Difference
Paragraphs (<p>) are semantic units. Line breaks (<br>) are presentational within those units:
<!-- Separate thoughts - use paragraphs -->
<p>This is one idea.</p>
<p>This is another idea.</p>
<!-- Related lines - use br -->
<p>
John Smith<br>
123 Main St<br>
New York, NY 10001
</p>
The address is one logical unit (a mailing address) split across lines for readability. Use <br>. Separate concepts go in separate <p> tags.
Legitimate Use Cases
Addresses:
<address>
Acme Corporation<br>
456 Business Blvd<br>
Suite 789<br>
San Francisco, CA 94105
</address>
Poetry and lyrics:
<p>
Two roads diverged in a yellow wood,<br>
And sorry I could not travel both<br>
And be one traveler, long I stood<br>
And looked down one as far as I could
</p>
Line breaks are part of the poem's structure. Paragraphs would add unwanted spacing.
Contact information:
<p>
Questions? Contact us:<br>
Email: support@example.com<br>
Phone: (555) 123-4567
</p>
Signature blocks:
<p>
Best regards,<br>
Jane Doe<br>
Senior Developer
</p>
When NOT to Use br
For spacing between paragraphs:
<!-- Bad -->
<p>First paragraph.</p>
<br><br>
<p>Second paragraph.</p>
<!-- Good - use CSS -->
<p>First paragraph.</p>
<p>Second paragraph.</p>
<style>
p { margin-bottom: 20px; }
</style>
Spacing is presentation. Control it with CSS, not markup.
For layout:
<!-- Bad -->
<h1>Title</h1>
<br><br><br>
<p>Content starts here</p>
<!-- Good - use CSS margins -->
<h1>Title</h1>
<p>Content starts here</p>
<style>
h1 { margin-bottom: 60px; }
</style>
For responsive line breaks:
<!-- Bad - breaks on mobile too -->
<h1>Long Title That<br>Breaks Awkwardly</h1>
<!-- Good - let browser handle wrapping -->
<h1>Long Title That Breaks Naturally</h1>
Browsers wrap text automatically based on container width. Hard-coded <br> tags break in unwanted places on different screen sizes.
Accessibility
Screen readers pause briefly at <br> tags. This is usually fine for addresses and poetry where breaks are meaningful.
But excessive <br> usage creates choppy reading. Each break interrupts flow. If you're using many <br> tags, reconsider the structure.
The <wbr> Tag Alternative
For suggesting optional break points without forcing them:
<p>This-is-a-very-<wbr>long-<wbr>hyphenated-<wbr>word</p>
The browser breaks at <wbr> only if the line is too long. Otherwise, the word stays together. This is better than <br> for responsive layouts.
CSS Alternatives
For controlled breaks based on content width, use CSS:
.address {
white-space: pre-line;
}
<p class="address">
John Smith
123 Main St
New York, NY 10001
</p>
white-space: pre-line preserves line breaks in the HTML source without <br> tags.
Or use flexbox with flex-wrap for automatic wrapping:
.contact-info {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
<div class="contact-info">
<span>Email: support@example.com</span>
<span>Phone: (555) 123-4567</span>
</div>
Multiple br Tags
Stacking <br> tags is almost always wrong:
<!-- Anti-pattern -->
<p>Text</p>
<br><br><br><br>
<p>More text</p>
This is presentation (spacing) in markup. Use CSS:
<p>Text</p>
<p style="margin-top: 80px;">More text</p>
Or better, add a class:
<p>Text</p>
<p class="large-top-margin">More text</p>
<style>
.large-top-margin { margin-top: 80px; }
</style>
Forms and Labels
Avoid <br> for form layout:
<!-- Bad -->
<label>Name:</label>
<br>
<input type="text">
<br><br>
<label>Email:</label>
<br>
<input type="email">
<!-- Better - use div or CSS -->
<div>
<label>Name:</label>
<input type="text">
</div>
<div>
<label>Email:</label>
<input type="email">
</div>
<style>
div { margin-bottom: 15px; }
label { display: block; }
</style>
Semantic markup with CSS styling is more flexible and accessible.
SEO Impact
<br> tags don't affect SEO directly. Search engines see them as line breaks within text. They don't change ranking or readability scores.
But excessive <br> usage suggests poor HTML structure, which indirectly affects SEO through reduced content quality signals.
Email HTML
Email HTML has limited CSS support. <br> tags are more acceptable in email templates where CSS layout doesn't work consistently:
<!-- Email template - br is acceptable -->
<p>
Thanks for your order!<br>
Order #12345<br>
<br>
Shipping to:<br>
123 Main St<br>
New York, NY
</p>
Email clients strip or ignore much CSS. <br> works reliably across all clients.
Testing br Placement
When in doubt, ask: "Is this break part of the content's meaning, or just presentation?"
- Address lines: Meaning (use
<br>) - Poetry lines: Meaning (use
<br>) - Spacing between sections: Presentation (use CSS)
- Responsive wrapping: Presentation (let browser decide)
Browser Rendering
All browsers render <br> the same: a line break with no extra spacing. Unlike <p>, which has default margins, <br> just breaks the line.
Further Reading
MDN's br element reference covers syntax and use cases.
The HTML specification's section on phrasing content explains where <br> fits semantically.
For poetry-specific markup, see the HTML spec's examples of poem formatting.
The <br> tag is simple but easy to misuse. Understanding when line breaks are semantic versus presentational keeps HTML clean.
0 comments