Using `<br>` for Line Breaks in Markdown — When It Works, When It Doesn't
When HTML `<br>` works in Markdown (GFM table cells, addresses), when sanitizers strip it, and when to prefer trailing-space or backslash hard breaks instead.
What you'll learn
- When
<br>is the right choice in Markdown (table cells, addresses, poetry) - Why sanitizers strip
<br>and how to check if that's happening - The CommonMark alternatives—two trailing spaces and backslash—and when to prefer them
- Accessibility and CSS considerations for line breaks
- A simple rule to settle "
brvs blank line" in team reviews
In Markdown, blank lines separate paragraphs, and hard breaks (two trailing spaces or a backslash at end of line) handle line breaks inside a paragraph. Even so, there are times when you want an HTML <br>—for example, inside a GFM table cell when you need two lines of text, or for addresses, short poetry, or stacked lines where you do not want a full new paragraph. Because <br> is real HTML, tools and sites may strip it during sanitization, so the break can "vanish" depending on environment.
When <br> is a good fit
In tables (GFM and similar), <br> is a common way to split explanatory text across two lines in one cell. It also helps when you want to keep one paragraph semantically but break lines visually. On the other hand, long prose chained with <br> can be hard to read on small screens or with screen readers—prefer blank-line paragraph breaks for long text.
Good uses of <br>:
- Inside a GFM table cell that needs two lines
- Addresses (postal code, city, street on separate lines)
- Poetry or lyrics with the same semantic paragraph
- Short stacked lines you don't want as separate paragraphs
Sanitization and "it doesn't work"
Many web apps restrict HTML for XSS protection. If <br> is not on the allowlist, it is removed at render time and the break is lost. You might see it in a local editor but not in production—this is why. If you own the pipeline, configure DOMPurify (or similar) to explicitly allow br where appropriate.
What to check:
- Does the CMS/tool allow raw HTML tags?
- Is
brin the DOMPurify allowlist? - Does a CI/CD sanitization step strip it?
Alternative syntax
| Method | Syntax | Best for |
|---|---|---|
| Blank line | text\n\ntext | New paragraph |
| Two trailing spaces | text + newline | In-paragraph break (if editor keeps trailing spaces) |
| Backslash | text\ + newline | In-paragraph break (most editor-safe) |
<br> | text<br>text | Table cells, addresses—in HTML-allowed environments |
CommonMark hard breaks: two spaces at end of line then newline, or a backslash at end of line then newline. These stay in "plain" Markdown and do not depend on raw HTML being allowed. Note: some editors trim trailing spaces on save—then the backslash form can be safer. A blank line starts a new paragraph and makes semantic breaks clearer. Treat <br> as a narrow tool: "same paragraph, new line only."
Accessibility
Do not stack many <br> tags just to add vertical space—that tends to be noise for assistive tech. Meaningful separation is usually better as paragraphs or lists.
Renderer and editor differences
GFM, CommonMark parsers, and note apps handle HTML differently. If <br> works in preview but disappears in CI-built HTML, check parser options (whether raw HTML is allowed, whether output is sanitized). The same .md can diverge between local preview and build.
Outside table cells
Relying on <br> in body copy makes it harder to unify line height and paragraph margins with CSS later. If your design system expects spacing via margin on paragraphs, blank lines + paragraphs usually style more predictably than <br>. Reserve <br> for short inline stacks.
Operations and review
When teams argue "br vs blank line," anchor on meaning: use a blank line when you want a new paragraph; use hard breaks or <br> only for short same-paragraph line splits. In static site generators or CMSes, if raw HTML is disabled, <br> may be escaped and shown as text—verify build settings too.
FAQ
<br> disappeared in my table cell
The CMS or portal sanitizer likely strips it. Check the platform's allowed HTML tags list; if <br> is absent, switch to a different approach or configure the pipeline to permit it.
<br> or two trailing spaces—which is more reliable?
It depends. <br> needs HTML permission; trailing spaces can be deleted by editors. The most reliable portable option is the backslash \ CommonMark hard break.
Multiple <br> tags create too much space
Use CSS margin or padding for spacing—not repeated <br> tags. Stacked breaks are also bad for accessibility.
<br> looks wrong in PDF output
In PDF (print pipeline), <br> rendering interacts with line-height and margin. Check the preview and tweak layout settings accordingly.
Summary
<br> is handy, but check HTML policy and document structure. Prefer trailing spaces, backslash breaks, or blank lines when you can. When unsure, ask: "Do I mean a new paragraph, or only a new line?"
Related
- How-to & BlogWhy Markdown Line Breaks Don't Show — Causes and FixesMarkdown ignores single Enter by design (CommonMark). Explains paragraph breaks vs hard breaks—blank lines, two trailing spaces, backslash, and `<br>`—with team writing tips.Read article
- How-to & BlogLine Breaks Inside Markdown Table Cells — GFM, `<br>`, and PDF-Safe PatternsLine breaks inside GFM table cells with `<br>`—when it works, when sanitizers strip it, how to prevent PDF overflow, and design alternatives when cells get too long.Read article