MDUtil

Line Breaks and New Lines in Markdown

Markdown joins lines that sit next to each other into one paragraph. End a line with a backslash to break it there, or leave a blank line to start a new paragraph.

Quick answer

How do you add a new line in Markdown?

End the line with a backslash \ and continue on the next line. Two spaces at the end of the line do the same, and <br> works wherever HTML is allowed. A single line break on its own is shown as a space; a blank line starts a new paragraph.

Markdown
Roses are red,\
violets are blue.

A blank line starts a new paragraph.

Result

Roses are red,
violets are blue.

A blank line starts a new paragraph.

Line break syntax and examples

There are three ways to break a line inside a paragraph, and one to start a new paragraph.

A single line break is joined

Lines next to each other become one paragraph, with a space where the break was. This lets you wrap long lines in the source.

Markdown
Roses are red,
violets are blue.

Result

Roses are red, violets are blue.

Backslash at the end of a line

A backslash right before the line end forces a break. It is visible in the source, so editors do not strip it.

Markdown
Roses are red,\
violets are blue.

Result

Roses are red,
violets are blue.

Two spaces at the end of a line

Two or more spaces before the line end also force a break. Here they follow the comma; they are invisible, and many editors remove them on save.

Markdown
Roses are red,  
violets are blue.

Result

Roses are red,
violets are blue.

The <br> tag

Where HTML is allowed, <br> breaks a line anywhere, including inside a table cell.

Markdown
Line one<br>line two

| Address |
| --- |
| 1 Main Street<br>Springfield |

Result

Line one
line two

Address
1 Main Street
Springfield

A new paragraph

A blank line starts a new paragraph, with more space than a line break.

Markdown
First paragraph.

Second paragraph.

Result

First paragraph.

Second paragraph.

Extra space between paragraphs

Several blank lines count as one. To add more space, put &nbsp; or <br> on a line of its own.

Markdown
Three blank lines follow.



They left a single gap.

&nbsp;

The line with `&nbsp;` above adds a visible gap.

Result

Three blank lines follow.

They left a single gap.

 

The line with &nbsp; above adds a visible gap.

Line breaks in popular apps

Some apps show every line break as typed. Others follow the Markdown rule and join lines.

AppSupportNotes
GitHubDiffersIssues, pull requests and comments keep every line break; Markdown files need a backslash, two spaces or <br>.
ObsidianSupportedEvery line break shows unless "Strict line breaks" is turned on in the settings.
Discord / SlackSupportedEvery line break shows. Shift+Enter adds one without sending.
NotionSupportedShift+Enter adds a line break inside a block; Enter starts a new block.
VS Code previewDiffersJoins single line breaks unless the markdown.preview.breaks setting is on.

Questions and answers

Why does Markdown ignore my line breaks?

A single line break inside a paragraph is treated as a space, so long lines can be wrapped in the source. End the line with a backslash or two spaces to keep the break.

Which way of adding a line break is best?

A backslash at the end of the line: it is part of CommonMark and GitHub Flavored Markdown, and it stays visible in the source. Two trailing spaces are easy to lose, and <br> works only where HTML is allowed.

How do I add a new line in a table cell?

Write <br> inside the cell. A real line break would end the table row.

How do I add more space between paragraphs?

Extra blank lines are ignored. Put &nbsp; or <br> on a line of its own between the paragraphs.

Why do line breaks work in GitHub comments but not in README files?

GitHub keeps every line break in issues, pull requests and comments, while Markdown files follow the standard rule. In files, use a backslash or two spaces.

How do I add a line break in a list item?

End the line with a backslash or two spaces and indent the next line to the item's text.

Does typing \n add a new line?

No. Markdown shows a backslash followed by n as those two characters. Press Enter and use one of the methods above.

How do I keep line breaks when converting to Word or PDF?

Mark them with a backslash, two spaces or <br>, or turn on "Keep single line breaks" in Markdown to Word or Markdown to PDF, which keeps every line break as typed.