Documentation
Home · Docs · Markdown · Markdown line breaks: soft and hard breaks

Markdown line breaks: soft and hard breaks

How to add a line break in Markdown with two trailing spaces or a backslash, soft versus hard breaks, and the HTML output.

A line break in Markdown forces text onto a new line inside the same paragraph. Create one by ending a line with two or more trailing spaces, or with a backslash (\), then a newline. A plain single newline is a "soft break" that most parsers render as a space, so it does not visibly break the line. Both hard-break methods compile to the HTML <br> element.

Markdown line breaks syntax reference

Goal Syntax
Hard break (spaces) End the line with two spaces, then newline
Hard break (backslash) End the line with \, then newline
Soft break (no visible break) A single newline with no marker
New paragraph A blank line

Markdown line breaks key facts

  • There are two portable ways to force a hard line break: end a line with two or more trailing spaces, or end it with a backslash, then a newline.
  • Both hard-break methods compile to the HTML <br> element inside the current paragraph.
  • A single newline in the source is a soft break that most renderers collapse into a space, so it does not visibly break the line.
  • A blank line is different from a line break: it ends the paragraph and starts a new one, producing a new <p> element.
  • The backslash break works in CommonMark, GitHub Flavored Markdown, and Pandoc, but not in classic Markdown or Markdown Extra.
  • Chat tools such as Slack, Discord, and Notion break on a single Enter, so they need no trailing spaces or backslash.

Choose a paragraph break unless a hard break is meaningful

A blank line starts a new paragraph. A hard line break keeps text in the same paragraph while forcing the next text onto a new line. Use hard breaks for addresses, poetry, or other content where the line boundary carries meaning, not as a substitute for paragraph spacing.

Two trailing spaces are widely supported but invisible during editing. A trailing backslash is easier to see and is defined by CommonMark, although not every older renderer supports it. Raw <br> requires inline HTML support. If a line wraps only because the editor window is narrow, leave it as a soft break and let the renderer handle the layout.

How to add a new line in Markdown

To add a new line (also written as one word, "newline") in Markdown, end the first line with two trailing spaces or a backslash, then type the next line. A plain Enter with no marker does not create a visible new line in most renderers: a lone newline is a soft break that shows as a space. The two methods below both force a hard break, which compiles to the HTML <br> element. Chat tools such as Slack and Discord are the exception, since they break on a single Enter.

Soft breaks vs hard breaks

Markdown distinguishes two kinds of break. A soft break is a single newline in your source with no trailing marker. Most renderers collapse it into a space, so the text flows together.

Markdown

This line and
this line are joined.

Rendered output

This line and this line are joined.

A hard break forces the text onto a new line within the same paragraph. There are two portable ways to write one.

Method 1: two trailing spaces

End a line with two or more spaces, then press Enter. The trailing spaces signal a hard break.

Markdown

Line one.··
Line two.

(The ·· marks two trailing spaces, which are invisible in a normal editor.)

Rendered output

Line one. Line two.

HTML output

<p>Line one.<br>
Line two.</p>

The drawback is that trailing spaces are invisible, and many editors and formatters strip them automatically, which silently breaks your formatting. For that reason the backslash method is often preferred.

Method 2: the backslash break

End a line with a single backslash, then a newline. CommonMark added this as a visible alternative to trailing spaces.

Markdown

Line one.\
Line two.

Rendered output

Line one.\ Line two.

HTML output

<p>Line one.<br>
Line two.</p>

Because the backslash is visible in the source, editors will not strip it. This makes it the more reliable choice in CommonMark, GitHub Flavored Markdown, and Pandoc. It is not part of classic Markdown or Markdown Extra, so check your target before relying on it.

Line break vs new paragraph

A line break keeps text in the same paragraph. A blank line starts a new paragraph. They produce different HTML and different spacing.

Markdown

Same paragraph, hard break.\
Second line here.

New paragraph after a blank line.

Rendered output

Same paragraph, hard break.\ Second line here.

New paragraph after a blank line.

HTML output

<p>Same paragraph, hard break.<br>
Second line here.</p>
<p>New paragraph after a blank line.</p>

Use a hard break when the lines belong together, such as lines of an address or a short verse. Use a blank line when you mean a genuine new paragraph.

The HTML break tag

You can also drop in a raw <br> tag where inline HTML is allowed. This works in most renderers but couples your document to HTML output.

Markdown

Line one.<br>
Line two.

Rendered output

Line one.
Line two.

Prefer the two Markdown methods for portable documents, and reserve <br> for cases where you are already writing HTML inside your Markdown.

Flavor differences

The trailing-spaces method is universal. The backslash method is not: it originates in CommonMark and is absent from classic Markdown and Markdown Extra. The table distinguishes core syntax from renderer-specific behaviour; preview hard breaks in the destination renderer.

Flavor Two trailing spaces Backslash (\) break Notes
CommonMark Yes Yes Both are hard breaks. A single newline is a soft break rendered as a space.
GitHub Flavored Markdown (GFM) Yes Yes Superset of CommonMark, same behavior.
MultiMarkdown Yes Verify Trailing spaces work. Backslash breaks are available through an escaped-newlines option that must be enabled.
Markdown Extra Yes No Follows classic Markdown for breaks. Backslash at end of line is not a hard break.
Pandoc Yes Yes Backslash break is the escaped_line_breaks extension, on by default in Pandoc's Markdown.

The single-newline behavior also varies by configuration. CommonMark and many renderers treat a lone newline as a soft break by default. Pandoc and some tools offer a hard_line_breaks mode that turns every newline into a <br>, which is common in chat apps.

Other platforms (Slack, Discord, Notion, Obsidian)

Chat and note tools handle breaks very differently from document renderers:

  • Slack and Discord: a single Enter creates a real line break in the message. They behave as if hard breaks are always on, and they do not use trailing spaces or backslashes.
  • Notion: Enter inside a text block creates a line break; Shift is not required. There is no trailing-space convention.
  • Obsidian: follows CommonMark by default, so use two trailing spaces or a backslash. Obsidian also has a "strict line breaks" setting that changes single-newline behavior.

For the full comparison of how flavors differ across all elements, see Markdown flavors.

How Markdific renders it

Markdific renders both hard-break methods, two trailing spaces and a backslash, as a line break inside the paragraph, producing a <br>. A single newline is treated as a soft break and joins the lines with a space.

Try it in the Markdific online editor.

Common mistakes and gotchas

  • Expecting a single newline to break the line. It does not. A lone newline is a soft break rendered as a space. Use a hard break method.
  • Invisible trailing spaces getting stripped. Editors and formatters often remove trailing whitespace on save, silently removing your break. Prefer the backslash method where supported.
  • One trailing space is not enough. You need at least two trailing spaces for a hard break.
  • Backslash break where it is not supported. In Markdown Extra and classic Markdown, a trailing \ is not a line break. Verify your target flavor.
  • Confusing a line break with a new paragraph. A hard break stays in the same paragraph. Only a blank line starts a new paragraph.
  • Trailing spaces before a backslash. Spaces between the text and the backslash can interfere. Put the backslash directly after the last character.

Best practices

  • Prefer the backslash break in CommonMark, GFM, and Pandoc, because it is visible and survives editing.
  • Use two trailing spaces only when your target does not support the backslash, and be aware editors may strip them.
  • Use a blank line, not a hard break, when you actually mean a new paragraph.
  • Avoid raw <br> tags in portable documents; reserve them for HTML-in-Markdown contexts.
  • When moving content into Slack, Discord, or Notion, remember those tools break on a single newline, so remove trailing-space or backslash markers to avoid double breaks.

HTML equivalent

Both Markdown hard-break methods compile to the HTML <br> element inside the surrounding <p>.

Markdown

First line.\
Second line.

HTML output

<p>First line.<br>
Second line.</p>

FAQ

How do you add a line break in Markdown? End the line with two or more trailing spaces, or with a backslash, then start the next line. Both create a hard line break inside the same paragraph.

How do I add a new line in Markdown? Add a new line (or newline) by ending the first line with two trailing spaces or a backslash, then typing the next line. A single Enter does not create a visible new line in most renderers, because a lone newline is a soft break rendered as a space. Chat tools such as Slack and Discord break on a single Enter instead.

Why is my Markdown line break not working? A single newline is a soft break and renders as a space. You need two trailing spaces or a backslash. If you used trailing spaces, your editor may have stripped them, so try the backslash method.

What is the difference between a soft break and a hard break? A soft break is a single newline that renders as a space, so the text flows together. A hard break forces the text onto a new line and produces a <br> element.

Should I use trailing spaces or a backslash for line breaks? Prefer the backslash where it is supported (CommonMark, GFM, Pandoc) because it is visible and will not be stripped by editors. Use trailing spaces only when the backslash is not supported.

What is the difference between a line break and a new paragraph? A line break keeps text in the same paragraph and produces a <br>. A blank line starts a new paragraph and produces a new <p> element.

Does the backslash line break work everywhere? No. It works in CommonMark, GitHub Flavored Markdown, and Pandoc, and through an option in MultiMarkdown. It is not a hard break in classic Markdown or Markdown Extra.

What HTML does a Markdown line break produce? A <br> element inside the surrounding paragraph.

Why does one newline break the line in Slack but not on GitHub? Slack and Discord treat every newline as a hard break. GitHub follows CommonMark, where a single newline is a soft break, so you need two trailing spaces or a backslash.

How do you add a blank line between paragraphs in Markdown? Leave an empty line in the source between the two blocks of text. Markdown collapses runs of blank lines, so one blank line and several blank lines produce the same single paragraph gap.

How do you break a line inside a table cell in Markdown? Standard table cells cannot take a trailing-space or backslash hard break. Use a <br> tag inside the cell, which most GitHub Flavored Markdown renderers accept.

Why did my line break disappear after I saved the file? Many editors strip trailing whitespace on save, which removes a two-space hard break. Switch to the backslash break, which is visible in the source and survives editing.

Does a backslash at the end of a line always create a line break? Only in flavors that support it, such as CommonMark, GFM, and Pandoc. In classic Markdown and Markdown Extra a trailing backslash is not a hard break.

Sources and compatibility references

Use these primary references for syntax rules. Renderer behaviour can still vary by version and configuration, so preview important documents in their final destination.