Articles
Published · July 13, 2026

Markdown Line Breaks: Why Your Text Runs Together (and How to Fix It)

You typed two lines and got one run-together sentence. That's not a bug — Markdown treats a single newline as a soft break by design. This guide covers why, the two ways to force a real hard break (trailing spaces vs. backslash), the <br> tag option, and the GitHub quirk that makes formatting look different in a comment than in a README.

Quick answer

A single newline inside a Markdown paragraph doesn't create a line break. It's a "soft break," and it folds straight into the surrounding text. To force a real one, end the line with a backslash (\) or two trailing spaces — both render as a <br> in the output. A blank line between two lines, on the other hand, always starts a new paragraph, in every renderer.

This line runs into
the next one.

This line breaks properly\
because of the trailing backslash.

The rest of this guide covers why Markdown works this way, which hard-break method actually holds up, and a GitHub quirk that trips up a lot of writers.

Step-by-step

Why your lines run together in the first place

Markdown's original syntax treats a paragraph as one or more consecutive lines of text separated by a blank line, not by every press of Enter. CommonMark's tutorial defines it the same way: a paragraph is consecutive lines with a blank line on either side, and a single newline in the middle is a soft break that folds into the line before it.

That's a deliberate design choice, not an oversight. Turning every newline into a <br> would be simpler, sure — but it would also break Markdown's email-style quoting and multi-paragraph list items, where writers routinely hard-wrap a paragraph across several source lines without meaning each wrap to become a visible break.

The two-trailing-spaces method

The original fix, and it's still supported everywhere: end a line with two or more spaces, then press Enter.

First line here.  
Second line here.

It works. It's also fragile. The spaces are invisible in the source, and plenty of editors and auto-formatters strip trailing whitespace on save, silently deleting the break you just added. The CommonMark spec flags a related edge case: trailing spaces at the very end of a paragraph get stripped before parsing, so a break placed there won't render at all.

The backslash method

A backslash at the end of the line produces the same hard break, and it's visible in the raw text:

First line here.\
Second line here.

It's a printable character, not invisible whitespace, so it survives editors that trim trailing spaces on save. CommonMark's tutorial documents this as the more deliberate of the two methods. There's one limitation worth knowing: a backslash escape does nothing inside code blocks, code spans, autolinks, or raw HTML. Our backslash escaping in Markdown guide covers the full set of rules on what a backslash can and can't do.

The <br> tag option

Where a renderer allows raw HTML inside Markdown, a literal <br> tag is a third way to force a break — and it works the same in most lightweight markup languages, not just Markdown. The trade-off: it mixes HTML into otherwise plain Markdown source, and plenty of renderers, including the one behind this article, don't allow raw HTML in the body at all. Not sure your target renderer accepts it? Use the backslash instead.

Common problems and fixes

My trailing-space break stopped working after I saved the file. Your editor or a pre-save formatter likely trimmed the trailing whitespace. Switch to the backslash method — it isn't affected by whitespace trimming.

The backslash isn't doing anything inside my code sample. That's expected. Backslash escapes don't apply inside code blocks, code spans, autolinks, or raw HTML. A line break inside a fenced code block is just a literal newline in the code itself.

My formatting looked right in a GitHub comment, then broke once I pasted it into a README. GitHub Flavored Markdown treats these two contexts differently. Comments, issues, and pull request descriptions render every newline as a visible break automatically, closer to a chat interface. Rendered .md files like READMEs follow the standard CommonMark rule instead: a single newline is a soft break, and you need a backslash, trailing spaces, or blank line to get the result you want.

I'm not sure which method my tool actually supports. Test it directly. Write two short lines with a plain newline between them and render the file. If they merge, try trailing spaces, then a backslash, one at a time, and see which one the renderer honors before you rely on it across a longer document. Running the result through a linter that catches formatting inconsistencies before publishing catches stray breaks that slipped through.

Frequently Asked Questions

Why does my Markdown text run together even though I pressed Enter?

Markdown treats a single newline inside a paragraph as a soft break, which renders as ordinary whitespace, not a visible line break. This is intentional — it lets writers hard-wrap long paragraphs across multiple source lines without every wrap turning into an unwanted break in the output. To force a real line break, you need explicit hard-break markup: two trailing spaces, a backslash, or a <br> tag where raw HTML is allowed.

Should I use two trailing spaces or a backslash for a hard line break?

A backslash is generally more reliable. Two trailing spaces work in most renderers, but they're invisible in the source, easy to lose to auto-trimming editors or formatters, and CommonMark strips trailing spaces at the very end of a paragraph before parsing, so a break you thought you added can silently vanish. A backslash at the end of the line is visible in the raw text and isn't affected by whitespace trimming, though it won't work inside code blocks, code spans, autolinks, or raw HTML.

Why do line breaks work differently in a GitHub comment than in a README file?

GitHub Flavored Markdown intentionally renders every newline as a visible break in comments, issues, and pull request descriptions, since that context behaves more like chat. Rendered .md files like READMEs follow the standard CommonMark rule instead, where a single newline is a soft break. Testing your formatting in a GitHub comment and then pasting it into a README is a common way this catches writers off guard.

Doing this with Carets

Chasing down an invisible trailing-space break is exactly the kind of formatting bug that's easier to avoid than to debug. Carets is a native Markdown, plain text, and code editor for iPhone, iPad, and Mac. Your files stay plain text, so a backslash line break or a blank-line paragraph split renders exactly the same on the page as it does in the editor — nothing is rewriting your formatting behind the scenes.

Carets applies the same syntax highlighting to Markdown and code, so a stray backslash or a missing blank line is easy to spot before you publish. And because notes stay organized into files, projects, and tags, a reference doc like this one — or your own cheat sheet for hard breaks and other whitespace-sensitive rules like nested list indentation — stays easy to find the next time text runs together.

Get Carets on the App Store for iPhone, iPad, and Mac.