Skip to content
Go back

Markdown new line: 4 ways to add a line break (with examples)

Updated:  at  06:00 AM

You hit Enter in your markdown expecting a new line. Nothing happens. You hit it twice and get a canyon-sized paragraph gap. All you wanted was a subtle break.

The short version: put a backslash \ at the end of a line, then hit Enter. That gives you a markdown new line (a <br> in HTML) without starting a new paragraph. Works in CommonMark, GitHub, Obsidian, and most modern processors. If that doesn’t work in your tool, use <br> instead.

Below: all four methods, which to use when, a compatibility table across 8 tools, and what to do when your line breaks aren’t working.

Table of contents

Open Table of contents

Line break vs paragraph break

Paragraph break — blank line between text. Two <p> elements, visible gap:

First paragraph.

Second paragraph.

Line break — next line starts directly below, same paragraph. One <p>, no gap:

123 Main Street\
Apt 4B\
Denver, CO 80202

If you’re getting paragraph gaps when you want tight lines, you’re accidentally creating paragraph breaks. The four methods below give you the tight ones.

The four ways to add a markdown line break

1. Backslash at the end of the line

Add a \ right before you hit Enter.

Line one.\
Line two.

This is the one I use. It’s visible in your source, it won’t get stripped by your editor, and it works in CommonMark, GitHub Flavored Markdown (GFM), Obsidian, and most modern processors.

2. Two trailing spaces

Add two spaces at the end of a line before hitting Enter.

Line one.··
Line two.

(The ·· represents two spaces. You can’t see them, which is the whole problem.)

This is the original markdown line break method from John Gruber’s spec. It works everywhere. But most code editors trim trailing whitespace automatically, which means your line breaks quietly vanish when you save. VS Code, Sublime, and most modern editors do this by default. You can disable it, but then you’re fighting your tools to preserve invisible characters, which is the opposite of fun.

3. HTML <br> tag

Just drop a <br> or <br /> tag directly into your markdown.

Line one.<br>
Line two.

Works in every markdown processor that allows inline HTML (which is almost all of them). It’s ugly in the source, but when you need a break and nothing else is cooperating, this is the fallback that never fails.

4. Just hit Enter (sometimes)

In some processors, a single Enter creates a line break without any special syntax:

Line one.
Line two.

GitHub issues and comments do this. So does Slack. But most markdown renderers following the CommonMark spec will just join these into a single line. Don’t rely on this unless you know your specific tool supports it.

Which method should you use

Backslash for anything in a modern editor. It’s explicit, it survives auto-formatting, and it reads clearly in the source. I write markdown in VS Code daily and this is the only method I trust not to disappear on save.

Two spaces if you’re writing for a processor that doesn’t support backslash (some older or nonstandard parsers). Just know your editor might strip them.

<br> when you need a line break inside a markdown table cell, inside bold/italic formatting, or anywhere backslash doesn’t play nice. Table cells are the big one — they don’t support any other line break method.

Single Enter only in tools you’ve tested. GitHub issues? Go for it. Your blog’s markdown processor? Test it first.

Compatibility across tools

Not every method works everywhere. Here’s what actually works as of 2026:

MethodCommonMarkGitHub filesGitHub issuesObsidianNotionSlackRedditMDX
Backslash \YesYesYesYesNoNoNoYes
Two spacesYesYesYesYesNoNoYesYes
<br> tagYesYesYesYesNoNoNoYes
Single EnterNoNoYesDependsYesYesYesNo

GitHub files vs GitHub issues behave differently. Your README follows GFM rules (backslash or double space), but issue comments auto-break on Enter.

Obsidian has a “Strict line breaks” toggle in Settings > Editor. Default is on (backslash/double space required). Turn it off and single Enter works, but your notes become less portable.

Notion and Slack just handle it. Single Enter, no syntax needed.

Markdown new line in VS Code

VS Code trims trailing whitespace on save by default (files.trimTrailingWhitespace). That kills the two-spaces method every time you save.

Two fixes. Option 1 (what I do): just use backslash. It’s not trailing whitespace, so VS Code leaves it alone. Option 2: disable trimming for markdown files only:

"[markdown]": {
  "files.trimTrailingWhitespace": false
}

Option 1 is less fighting with your editor. I stopped using option 2 years ago.

New line in GitHub markdown

The gotcha here: .md files and issue comments use different rules. You format something nicely in an issue (where single Enter works), paste it into a README (where it doesn’t), and everything collapses into one line. For .md files, use backslash or double space.

Markdown newline in Obsidian

If you publish your vault to a blog or push notes to GitHub, keep Strict line breaks on (Settings > Editor) and use backslash. With strict mode off, single Enter works inside Obsidian but those breaks will vanish anywhere else.

Why your markdown new line isn’t working

Quick checklist:


Four methods, one big table, and now you know which one to use where. The backslash is the answer 90% of the time. For the other 10%, there’s <br>.

New posts, shipping stories, and nerdy links straight to your inbox.

Real insights. Zero filler.


Share this post on:

Previous Post
Claude Code's effort parameter: when to go full send and when to chill
Next Post
How to export, save, and share a Claude Code conversation