All posts

Markdown Line Breaks and New Lines: Why They Don't Work Like You Expect

How to make a markdown line break actually appear — two trailing spaces, a backslash, a break tag, or a blank line — and why a plain new line in markdown gets silently ignored.

Short answer: A markdown line break needs more than pressing Return. Press Return twice — a blank line — to start a new paragraph. To break a line within a paragraph, end the line with two spaces, or a backslash, or a break tag. A single new line in markdown is treated as an ordinary space and disappears when the document renders.

You wrote an address across three lines. It came out as one long line. You wrote a poem; it rendered as prose. Nothing is broken — this is markdown behaving exactly as designed, and the design decision is inherited from HTML, where consecutive whitespace collapses and line breaks in the source mean nothing.

Here is every method, which flavors support it, and which one to reach for.


Why a Single New Line Disappears

Markdown was built to produce HTML. In HTML, this:

<p>Line one
Line two</p>

renders as "Line one Line two" on a single line, because browsers collapse whitespace. Markdown inherits that. A newline inside a paragraph is a soft break — meaningful to the person reading the source, invisible in the output.

That behavior is deliberate and useful. It's what lets you hard-wrap your source at 80 columns, or let your editor wrap wherever it likes, without the wrapping leaking into the rendered document. The cost is that when you do want a visible break, you have to ask for it.

A break you explicitly request is a hard break, and it becomes a break tag in the HTML output.


Method 1: A Blank Line (New Paragraph)

Leave an empty line between two blocks of text and you get two paragraphs:

This is the first paragraph.

This is the second paragraph.

This is the most reliable thing in all of markdown. It works in every flavor, every renderer, every platform, going back to the original 2004 implementation.

It's also usually what you actually want. Most of the time when people reach for a line break, they want a paragraph. Paragraphs get proper vertical spacing, they're semantically correct, and nothing can strip them.

Reach for the hard-break methods below only when the lines genuinely belong together — an address, a poem, a signature block, a table cell.


Method 2: Two Trailing Spaces

End a line with two or more spaces, then Return:

123 Fake Street··
Springfield, IL··
62704

(The ·· above marks the two invisible spaces.) That renders as three lines inside one paragraph.

This is the original Markdown syntax and the most widely supported hard break. It's also the most fragile thing in the format, because the syntax is invisible:

  • Editors strip it. "Trim trailing whitespace on save" is on by default in many editors and enabled by most .editorconfig files. Your formatting silently vanishes when you save.
  • Formatters strip it. Prettier converts trailing-space breaks into backslashes or removes them, depending on configuration.
  • Reviewers can't see it. In a diff, a two-space break and a plain newline look identical.
  • Copy-paste breaks it. Moving text through a chat app or a web form often normalizes the whitespace away.

If you use trailing spaces, be aware you're relying on characters no one can see and several common tools actively remove.


Method 3: A Trailing Backslash

End the line with a single backslash:

123 Fake Street\
Springfield, IL\
62704

Same output as two trailing spaces, but visible in the source, survives whitespace trimming, and shows up plainly in a diff.

The catch is support. The backslash hard break is part of CommonMark, and therefore works in GFM, GitHub, GitLab, VS Code, Obsidian, and anything built on remark, markdown-it, cmark, or goldmark. It is not in the original Markdown spec, so a few older or non-standard parsers will render a literal backslash. If you're publishing through a pipeline you don't control, test it once.


Method 4: An HTML Break Tag

Drop the raw HTML in:

123 Fake Street<br>
Springfield, IL<br>
62704

The <br> tag renders anywhere raw HTML passes through, which covers GitHub, GitLab, most static site generators, and most editors. In MDX or JSX-based systems, write it self-closed as <br />.

Where it fails: platforms that don't allow HTML at all. Reddit, Discord, and Slack will show you the literal tag. Some static site setups disable raw HTML in markdown for security, in which case the tag is stripped or escaped.

It's also the only option that works inside a table cell.


Comparison

MethodSyntaxVisible in sourceCommonMarkGFMSurvives whitespace trimmingWorks in tables
Blank lineEmpty lineYesYesYesYesNo
Two spacesline··NoYesYesNoNo
Backslashline\YesYesYesYesNo
Break tagline<br>YesRaw HTMLRaw HTMLYesYes

The practical rule: blank line for paragraphs, backslash for hard breaks in files you control, <br> inside tables and anywhere you need raw HTML certainty. Avoid trailing spaces unless you're matching an existing document's style.


Line Breaks Inside Lists

Inside a list item, a hard break keeps the text in the same bullet:

- First item\
  continued on a second line
- Second item

The continuation line must be indented to line up with the item's text, or the parser treats it as a lazy continuation and — depending on the flavor — may fold it back in or break the list entirely.

A blank line inside a list has a different effect: it makes the list loose, which wraps every item in a paragraph tag and adds vertical spacing between all of them. If your list suddenly grew a lot of white space, that's why.


Line Breaks Inside Tables

Pipe table cells hold inline content only, so neither blank lines nor the two-space break work. The only option is the break tag:

| Feature | Notes |
|---------|-------|
| Export | PDF<br>HTML |
| Themes | Default, Nord<br>Solarized, One Dark |

A backslash break inside a cell renders as a literal backslash in most parsers. See the markdown tables syntax guide for the rest of what cells can and can't contain.


Line Breaks Inside Blockquotes

Inside a blockquote, a hard break works the same way, but the blank-line rule has a wrinkle. To get two paragraphs inside one quote, the blank line between them still needs its own >:

> First quoted paragraph.
>
> Second quoted paragraph.

Omit the > on the middle line and you get two separate blockquotes with a gap between them. More on that in markdown blockquotes.


The Flavor Differences That Catch People Out

GitHub renders line breaks in comments but not in files. In issues, pull requests, and discussions, GitHub automatically converts a single newline into a hard break — type two lines, get two lines. The identical text in a .md file in the repository renders as one line. This is the single most common source of "it looked right when I previewed it" confusion.

Obsidian breaks on single newlines by default. Obsidian ships with "Strict line breaks" turned off, meaning a single Return produces a visible break in Reading view. Turn the setting on and Obsidian follows the CommonMark rule instead. Notes written under one setting can look wrong under the other, and they look different again on GitHub.

Discord and Slack break on every newline. Both use their own reduced markdown-like syntax where Return means what you'd expect. Neither supports raw HTML, so <br> shows up as text.

MDX needs self-closing tags. In MDX, HTML is parsed as JSX, so <br> is a syntax error. Use <br />.

Static site generators vary. Some enable a "breaks" option that converts every newline to a break tag. If your markdown looks correct in your editor and wrong on your site, check that setting before rewriting anything.


Seeing What You Actually Typed

Most line-break problems are invisible in the source, which is why they're so persistent. Two spaces look like one space. A stripped break leaves no trace.

The fix is a workflow where you can see the rendered result and the raw source of the same file without leaving the app. OpenMark puts them one keystroke apart: Document view renders the file exactly as a GFM parser would, and Markdown view shows the untouched source with syntax coloring. Toggle between them and a missing break stops being a mystery. If you're comparing tools for this, how to preview markdown on Mac covers the alternatives.

For the rest of the syntax, the markdown cheat sheet has everything on one page.


Download OpenMark → — $9.99, one-time, native macOS. Switch between rendered output and raw source instantly, and stop guessing where your line breaks went.