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.
Line 1
Line 2Line 1
Line 2
Add two spaces at the end of the line, then press Return. Invisible in most editors, but supported everywhere CommonMark is.
Line 1\
Line 2Line 1
Line 2
A backslash immediately before the line ending creates a hard break. Cleaner to read in source, and part of CommonMark/GFM.
Line 1<br>
Line 2Line 1
Line 2
Use <br> as a fallback in HTML-enabled renderers. Stripped in Slack and Discord.
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.
Line 1
Line 2Line 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.
Paragraph one.
Paragraph two.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.
- First line of this item\
Second line of this item
- Item two- 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.
- Item one, line one<br>line two
- Item two- Item one, line one
line two - Item two
Use <br> as a fallback when you cannot guarantee proper indentation.
| Cell | Description |
|------|-------------|
| A | Line one<br>line two || 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 2Fixed
Line 1
Line 2Broken
Line 1
Line 2Fixed
Line 1
Line 2Broken
Line 1\
Line 2Fixed
Line 1\
Line 2Broken
Line 1<br>
Line 2Fixed
Line 1
Line 2Quick Reference
| Syntax | Result | Notes |
|---|---|---|
| Line 1 \nLine 2 | Hard break | Two trailing spaces; invisible |
| Line 1\\\nLine 2 | Hard break | Backslash before newline |
| Line 1<br>\nLine 2 | Hard break | HTML fallback |
| Line 1\nLine 2 | Soft break (space) | CommonMark/GFM default |
| Paragraph one.\n\nParagraph two. | New paragraph | Blank 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.
| Platform | Supported? | Notes |
|---|---|---|
| GitHub | Yes | Two spaces, backslash, or <br> create hard breaks; single newline renders as a space. |
| GitLab | Yes | Same GitHub Flavored Markdown behavior as GitHub. |
| Yes | Standard Markdown hard-break rules apply. | |
| VS Code preview | Yes | Default preview treats single newlines as spaces; two spaces or backslash for hard breaks. |
| Obsidian | Yes | Single newlines render as breaks by default; enable Strict line breaks to match CommonMark. |
| Notion | Partial | Paste can lose trailing spaces; use Shift+Enter after importing to create clean breaks. |
| Discord | Partial | Shift+Enter inserts a newline. Markdown trailing-space syntax is irrelevant in chat. |
| Slack | Partial | Shift+Enter inserts a newline. Markdown trailing-space syntax is irrelevant in chat. |
| CommonMark | Yes | Two 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 <br> 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 <br>.
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 <p> 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 <br> 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 <br> 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 <br> 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: