Skip to main content

Markdown Line Breaks

How to control line breaks in Markdown: two trailing spaces, a backslash at the end of a line, blank-line paragraphs, and the HTML <br> fallback.

Basic Syntax

To force a line break without starting a new paragraph, end the line with two spaces or a backslash. The spaces are invisible, so many writers prefer the backslash in shared source files.

Two trailing spaces
Line 1  
Line 2
Preview

Line 1
Line 2

Add two spaces at the end of the line, then press Return. Invisible in most editors, but supported everywhere CommonMark is.

Backslash at end of line
Line 1\
Line 2
Preview

Line 1
Line 2

A backslash immediately before the line ending creates a hard break. Cleaner to read in source, and part of CommonMark/GFM.

HTML line break
Line 1<br>
Line 2
Preview

Line 1

Line 2

Use &lt;br&gt; as a fallback in HTML-enabled renderers. Stripped in Slack and Discord.

Trailing spaces are invisible. If you copy the two-space example, check that the first line ends with exactly two spaces. Many editors strip trailing whitespace on save.

Soft vs Hard Breaks

A soft break is a single newline that renders as a space. A hard break forces the next line to start on a new visual line while keeping the text inside the same paragraph.

Soft break (single newline)
Line 1
Line 2
Rendered output

Line 1 Line 2

CommonMark and GFM render a single newline as a space, not a line break.

Paragraph Breaks

Leave a blank line between blocks to start a new paragraph. This creates two separate <p> elements in the output.

Blank-line paragraph break
Paragraph one.

Paragraph two.
Preview

Paragraph one.

Paragraph two.

Line Breaks in Lists & Tables

Inside a list item, Markdown hard-break syntax works as long as the next line is indented enough to stay part of that item. Standard pipe tables do not support Markdown line-break syntax inside cells, so use <br> there where HTML is allowed.

List item with Markdown hard break
- First line of this item\
  Second line of this item
- Item two
Preview
  • First line of this item
    Second line of this item
  • Item two

The continuation line is indented by two spaces so it stays inside the same list item. The same works with two trailing spaces instead of a backslash.

List item with an HTML line break
- Item one, line one<br>line two
- Item two
Preview
  • Item one, line one
    line two
  • Item two

Use <br> as a fallback when you cannot guarantee proper indentation.

Table cell with an internal line break
| Cell | Description |
|------|-------------|
| A    | Line one<br>line two |
Preview
Cell Description
A Line one
line two

Platform Differences

Most document renderers follow CommonMark rules. Chat apps do not: they let you insert a newline with Shift+Enter, so Markdown line-break syntax is irrelevant there.

GitHub, GitLab, VS Code
Single newlines render as spaces. Use two trailing spaces, a backslash, or <br> for hard breaks.
Obsidian
Single newlines render as line breaks by default. Enable Strict line breaks in settings to match CommonMark behavior.
Discord and Slack
Press Shift+Enter to add a newline inside a message. Markdown trailing-space syntax is not used.
Notion
Pasting Markdown can drop trailing spaces. After pasting, use Shift+Enter inside a block to create breaks reliably.

Common Mistakes

The hardest part of Markdown line breaks is that you cannot see trailing spaces. These are the mistakes that waste the most time.

Broken

Line 1
Line 2

Fixed

Line 1  
Line 2
A single newline is treated as a space in CommonMark and GFM. Add two trailing spaces (or a backslash) to force a line break.

Broken

Line 1

Line 2

Fixed

Line 1  
Line 2
A blank line starts a new paragraph. Use a hard break if you want one paragraph split across two visual lines.

Broken

Line 1\ 
Line 2

Fixed

Line 1\
Line 2
A backslash hard break must be the last character on the line. Anything after it, including a space, breaks the syntax.

Broken

Line 1<br>
Line 2

Fixed

Line 1  
Line 2
HTML &lt;br&gt; is stripped in Slack and Discord. Use Shift+Enter there, or use Markdown hard-break syntax in document renderers.

Quick Reference

SyntaxResultNotes
Line 1 \nLine 2Hard breakTwo trailing spaces; invisible
Line 1\\\nLine 2Hard breakBackslash before newline
Line 1<br>\nLine 2Hard breakHTML fallback
Line 1\nLine 2Soft break (space)CommonMark/GFM default
Paragraph one.\n\nParagraph two.New paragraphBlank line between blocks

Platform Support

Hard breaks are part of the CommonMark spec, so they work in most document renderers. Chat apps use their own input handling.

PlatformSupported?Notes
GitHubYesTwo spaces, backslash, or &lt;br&gt; create hard breaks; single newline renders as a space.
GitLabYesSame GitHub Flavored Markdown behavior as GitHub.
RedditYesStandard Markdown hard-break rules apply.
VS Code previewYesDefault preview treats single newlines as spaces; two spaces or backslash for hard breaks.
ObsidianYesSingle newlines render as breaks by default; enable Strict line breaks to match CommonMark.
NotionPartialPaste can lose trailing spaces; use Shift+Enter after importing to create clean breaks.
DiscordPartialShift+Enter inserts a newline. Markdown trailing-space syntax is irrelevant in chat.
SlackPartialShift+Enter inserts a newline. Markdown trailing-space syntax is irrelevant in chat.
CommonMarkYesTwo spaces or a backslash at the end of a line produce a hard line break.

Frequently Asked Questions

How do I add a line break in Markdown?

Use two trailing spaces at the end of a line, then press Return. You can also put a backslash immediately before the line ending, or use an HTML &lt;br&gt; tag where inline HTML is allowed.

Why does my Markdown line break disappear?

CommonMark and GitHub Flavored Markdown treat a single newline as a space. To keep a line break, add two trailing spaces or a backslash before the newline, or use &lt;br&gt;.

What is the difference between a line break and a paragraph break in Markdown?

A line break splits one paragraph across two visual lines. A paragraph break is a blank line that creates a new &lt;p&gt; element. Use a line break for addresses, poems, or short lines; use a paragraph break for separate thoughts.

Do Markdown line breaks work inside tables?

Standard pipe tables do not support Markdown line-break syntax inside cells. Use &lt;br&gt; inside the cell where the renderer accepts inline HTML. Otherwise keep each cell content on one line.

Do Markdown line breaks work inside lists?

Yes. Hard breaks work inside a list item when the next line is indented enough to stay part of that item (for a dash list, usually two spaces). Use two trailing spaces or a backslash at the end of the line, just as you would in a normal paragraph. If you cannot control indentation, use &lt;br&gt; or split the content into a nested sub-item.

Does GitHub render single line breaks?

No. In rendered Markdown files, issues, and pull requests, GitHub treats a single newline as a space. Use two trailing spaces, a backslash, or &lt;br&gt; to force a hard line break.

How do I insert a line break in Discord or Slack?

Press Shift+Enter to insert a new line without sending the message. The Markdown trailing-space and backslash syntax for hard breaks does not apply in chat composers.

Related Markdown Guides

Line breaks sit next to paragraphs, horizontal rules, lists, and tables. These guides cover the surrounding syntax: