Why one Enter does nothing
Markdown is meant to be read as plain text too, and people wrap long lines in their editor to keep them readable. If every Enter became a line break, the page would break wherever the editor wrapped. So Markdown treats lines that sit next to each other as one paragraph, and asks you to say when you really want a break.
Four ways to break a line
1. A backslash at the end of the line. Easy to see in the source, and it works in CommonMark and GitHub Flavored Markdown.
You write
Roses are red\
Violets are blueYou see
Roses are red
Violets are blue
2. Two spaces at the end of the line. The original way. It works almost everywhere, but the spaces are invisible, and some editors delete them when you save.
You write
Roses are red
Violets are blueYou see
Roses are red
Violets are blue
3. The <br> tag. Plain HTML, and the only way that works inside a table
cell.
You write
Roses are red<br>Violets are blueYou see
Roses are red
Violets are blue
4. An empty line, for a new paragraph. Not a line break but a paragraph break, with a little more space between. Use it most of the time.
You write
Roses are red.
Violets are blue.You see
Roses are red.
Violets are blue.
Which one to use
| You want | Use |
|---|---|
| A new paragraph | An empty line |
| A break inside a paragraph | A backslash at the end |
| A break inside a table cell | <br> |
| An address or a poem | A backslash on each line |
Line breaks in a table cell
A table row must stay on one line in the source, so a backslash or Enter
cannot work there. Use <br>.
You write
| Name | Address |
| ---- | -------------------------------- |
| Ana | 12 River Road<br>Lisbon<br>Portugal |You see
| Name | Address |
|---|---|
| Ana | 12 River Road Lisbon Portugal |
Line breaks in a list
Inside a list item, break with a backslash. For a whole new paragraph inside the item, leave an empty line and indent the next line to line up with the item's text.
You write
- First line of the item\
second line of the same item
- An item with two paragraphs.
The second paragraph, indented two spaces.You see
-
First line of the item
second line of the same item -
An item with two paragraphs.
The second paragraph, indented two spaces.
Add more space between paragraphs
Several empty lines count as one. Markdown has no way to add extra space; the
look of the page decides the spacing. If you must, an empty <br> on its own
line adds one line of space in many renderers.
Questions
How do I add a new line in Markdown without a new paragraph?
End the line with a backslash \, or two spaces, then press Enter. The text
continues on the next line inside the same paragraph.
Why are my line breaks ignored in Markdown?
Because a single Enter joins lines into one paragraph. Add a backslash or two spaces at the end of the line, or leave an empty line between paragraphs.
Does a new line work the same on GitHub?
In .md files, yes: the rules on this page apply. GitHub comments and issues
are more forgiving and keep single line breaks as they are typed.
How do I add a line break in a code block?
Just press Enter. Code blocks keep every line exactly as typed. See Markdown code blocks.
Next
- Markdown lists, where indentation decides what belongs to which item.
- Check your line breaks in the reader, free and with no upload.