HTML Tags for Line Break: br, wbr and CSS white-space

November 11, 2026 · 10 min read

HTML Tags for Line Break: How to Use br, wbr, and CSS

The HTML tags for line break are <br>, which ends a line inside a block, and <wbr>, which marks where a long word or URL may wrap. To add a line break in HTML, put <br> where the line should end. Start a new idea with a new <p>, and use CSS white-space for text that already contains newlines.

How to Add a Line Break in HTML With br

The <br> element ends the current line, and the text after it starts at the beginning of the next one. It stays inside the same paragraph, so you don't get the extra gap a new paragraph adds. The HTML Living Standard says to use it only for breaks that are part of the content, such as a postal address or a poem.

<p>
  Ada Example<br>
  12 Sample Lane<br>
  Springfield 00000
</p>

That renders as three short lines inside one paragraph:

Ada Example
12 Sample Lane
Springfield 00000

<br> is a void element. It has no content and no closing tag, which is why you never write <br>text</br>. If you were looking for a horizontal line across the page rather than a new line of text, that's a different void element, <hr>.

Is It <br>, <br/>, or <br />?

In an HTML document, all three are valid and produce the same break. The HTML syntax rules say a trailing slash on a void element "has no effect of any kind", so the parser simply ignores it. The space before the slash doesn't matter either.

The slash matters elsewhere. XHTML and other XML-based formats need a self-closed <br /> (the space is optional), and so does JSX. React's docs state that JSX requires every tag to be explicitly closed, so <br> fails to compile there. MDX follows the same rule.

</br> is the one form that's wrong everywhere. The HTML parser treats a stray </br> as a parse error and turns it into a <br> start tag, so the page still shows a break. A validator will flag it, though, and you shouldn't rely on error recovery.

We prefer plain <br> in .html files because it's shorter and matches the spec's own examples. Write <br /> only where your toolchain requires it, such as JSX, MDX or XHTML.

Which Other Empty Tags Work Like br?

An empty tag, or void element, can't hold content and never takes an end tag. The HTML standard lists 13, and the ones you'll meet most are wbr, hr, img, input, meta and link. The slash rule above applies to all of them, so <img src="a.png"> and <img src="a.png" /> mean the same thing in HTML. The full list is in our guide to HTML tags and elements.

br vs p: When a New Paragraph Is the Better Choice

Use <br> when the line division belongs to the text itself. Use <p> when you're starting a new thought. A three-line address is one unit, so it gets <br> tags. Two separate ideas get two <p> elements, even when each is a single sentence.

The spec calls out two common misuses. Don't put <br> between a list of links, and don't use it to stack form fields. Wrap each item in its own <p> or use a list:

<!-- Avoid -->
<label>Name <input name="name"></label><br>
<label>Email <input name="email"></label>

<!-- Prefer -->
<p><label>Name <input name="name"></label></p>
<p><label>Email <input name="email"></label></p>

Stacking <br><br> to push content down the page is the other habit to drop. MDN's br reference warns that this confuses people who use screen readers, which may announce each <br> even though it holds no content. Set the gap with CSS margin on the paragraph, or line-height for space between lines.

Why Do Newlines in Your HTML Source Disappear?

Pressing Enter in your HTML file does nothing visible, and that catches a lot of beginners out. The browser keeps the spaces and newlines in your text, but CSS collapses them when it draws the page. Under the default white-space: normal, a newline counts as ordinary whitespace, and any run of whitespace shrinks to one space.

<p>Roses are red
Violets are blue</p>

That displays as a single line: "Roses are red Violets are blue". The newline didn't vanish. It turned into the space between "red" and "Violets".

The old fix is the <pre> element. Browsers style it with white-space: pre, so every newline and space you type shows up, in a monospace font. That suits code samples, but it's a poor fit for an address on a contact page. The CSS route below gives you the same control on any element.

CSS white-space: Line Breaks Without the br Tag

The white-space property decides two things: whether runs of spaces collapse, and whether newlines in the source produce line breaks. Here's how each value behaves, based on MDN's white-space reference:

ValueNewlines in sourceRuns of spacesWraps long lines
normalBecome a spaceCollapse to oneYes
nowrapBecome a spaceCollapse to oneNo
preKept as breaksKeptNo
pre-wrapKept as breaksKeptYes
pre-lineKept as breaksCollapse to oneYes
break-spacesKept as breaksKept, and trailing spaces take up roomYes

pre-line is the one you'll reach for most. It's ideal for text that arrives with newlines already in it, like a comment box, an address stored in a database, or a product description from a CMS.

.user-comment {
  white-space: pre-line;
}

With that rule, a comment typed on three lines shows on three lines, with no <br> tags added on the server. Use pre-wrap instead when the spaces matter too, such as ASCII art or indented snippets. In current CSS, white-space is a shorthand for white-space-collapse and text-wrap-mode, though the keywords above still work as written.

Sometimes you want the opposite and need to strip the line breaks out of pasted text. The remove line breaks tool joins the lines for you in the browser.

wbr and Soft Hyphens: Optional Breaks for Long Words and URLs

Of the two line break tags, <wbr> is the one most guides skip. A long URL or compound word can push past the edge of a narrow screen, because the browser finds nowhere to wrap it. This tag marks a spot where a break is allowed but not forced. If the word fits, nothing happens. If it doesn't, the line breaks there with no hyphen, as the MDN wbr page describes.

<p>docs.example.com<wbr>/guides<wbr>/getting-started<wbr>/installation</p>

On a wide screen, that path displays on one line. On a phone, it wraps before a slash instead of overflowing. Placing <wbr> before punctuation keeps a dot or slash from dangling at the end of a line, where a reader might mistake it for the end of the URL.

For words rather than URLs, the soft hyphen entity &shy; works the same way but shows a hyphen when the break happens:

<p>Inter&shy;nation&shy;al&shy;ization</p>

You won't see the hyphens unless the word wraps. If you can't edit the markup, CSS handles it. overflow-wrap: anywhere lets the browser break an unbreakable string at any point. hyphens: auto adds hyphens, as long as the page sets a lang attribute and the browser has a hyphenation dictionary for that language.

Why br Shows Up in Markdown Too

Markdown converts to HTML, so when a Markdown line break is rendered, it becomes a <br> in the output. That's also why <br> works as a fallback in Markdown in spots where the usual syntax doesn't, such as inside a table cell. Our Markdown line break guide covers the Markdown methods, and Markdown vs HTML explains how the two languages fit together.

Our editor treats a single line break inside a paragraph as a <br>, GitHub comment style. So a <br> at the end of a line gives you two breaks, not one. Try it in the demo below:

Address written with br tags on one line:

Ada Example<br>12 Sample Lane<br>Springfield 00000

The same address typed on three lines:

Ada Example
12 Sample Lane
Springfield 00000

A br at the end of a line doubles the break here:<br>
see the gap above this line.

Who has seen the wind?
Neither I nor you:
But when the leaves hang trembling
The wind is passing thro’.

65 words368 characters17 lines
Markdown

Both addresses render identically in the preview. Run the text through the Markdown to HTML converter and each address becomes one <p> with <br> between the lines. The verse, from Christina Rossetti's public-domain Sing-Song, gets the same treatment.

Line Breaks in HTML Email

Email is where <br> earns its keep. Email clients strip or rewrite a lot of CSS, and support for white-space isn't uniform. Can I email's white-space test only covers nowrap and pre, and it marks pre as unsupported in several clients. It doesn't test pre-line at all.

That's a real limitation of the CSS approach. A pre-line comment box that looks right on your site can collapse into one long line in someone's inbox. For transactional email, such as receipts, shipping notices or signatures, convert newlines to <br> tags before you send. Keep <p> for actual paragraphs, and test in the clients your readers use.

Which of the HTML Tags for Line Break Should You Use?

Each option solves a different problem, so match the tool to the job:

Your situationUse
An address, a poem or song lyrics<br> at the end of each line
A new idea or topicA new <p>
More space between blocksCSS margin, not stacked <br> tags
Text that arrives with newlines, like commentswhite-space: pre-line
Text where the spaces matter toowhite-space: pre-wrap, or <pre> for code
A long URL or file path<wbr> before slashes and dots
A long word that should hyphenate&shy;, or hyphens: auto in CSS
HTML email<br>, converted from newlines before sending

The HTML tags for line break are small, but the right choice keeps your markup clean for browsers, validators and screen readers. When you're unsure, ask whether the break belongs to the text or to the layout. Text gets <br>, layout gets CSS. To watch Markdown line breaks become <br> tags, write in the editor, then run the text through the Markdown to HTML converter and read the output.