Markdown Line Break: How to Add New Lines Without Breaking Formatting
If you have ever typed a sentence, hit Enter, typed another sentence, and watched Markdown mash them into one paragraph anyway, you have run into the most common gotcha in the spec. Markdown was designed to treat single line breaks in your source as whitespace, not formatting — so the fix has to be explicit. This guide covers the three ways to force a real line break, how each one renders differently across renderers, and why line breaks matter more than usual once you are feeding Markdown into an LLM or RAG pipeline. If you are converting existing documents rather than writing from scratch, file2markdown handles this automatically — see the workflow section below.
The Quick Answer
Markdown (CommonMark and GitHub Flavored Markdown) gives you three ways to force a line break inside the same paragraph:
- Trailing two spaces at the end of a line, then Enter. The classic method — invisible in most editors, which is exactly why it causes so many bugs.
- A trailing backslash (
\) at the end of a line, then Enter. Supported by CommonMark, Pandoc, and most modern renderers; visible in the raw source, which makes it easier to spot in diffs. - An explicit
<br>tag. Works everywhere Markdown allows inline HTML, and is the least ambiguous option when you're generating Markdown programmatically.
And for a new paragraph instead of a line break within one, you don't need any of the above — just leave a completely blank line between blocks of text. That's the mechanism most people actually want.
Why a Single Enter Doesn't Work
Markdown's parser treats a lone newline as a space character. Two lines separated by one Enter get joined into a single paragraph when rendered:
Line one
Line two
renders as "Line one Line two" — not two lines. This is intentional: it lets you hard-wrap your source text at 80 columns for readability without forcing the same wrapping on the rendered output. The tradeoff is that anyone writing Markdown by hand has to learn one of the three break methods above, and anyone generating Markdown from another format has to reconstruct line breaks that the source format expressed differently (a Word paragraph mark, an HTML <br>, a PDF's positional line, and so on).
Line Breaks in Lists, Tables, and Code Blocks
The three methods behave differently depending on where you use them:
- Inside a list item, a trailing backslash or two spaces creates a line break within that item without starting a new list item. A blank line, by contrast, can close the list entirely in some renderers — use the backslash or
<br>method here. - Inside a table cell, you generally can't use a literal newline at all (it breaks the table's row-per-line syntax). Use
<br>inside the cell instead — it's the only reliable option across GitHub, GitLab, and most static site generators. - Inside a fenced code block, none of this applies — a code block preserves whitespace exactly as written, including every newline, because it isn't parsed as Markdown at all.
- An "empty line" (two consecutive blank lines, or a line with trailing spaces and nothing else) usually just collapses to a single paragraph break — it doesn't add extra vertical space in the rendered output the way it might in a word processor.
Why This Matters More for AI and RAG Pipelines
If you're preparing Markdown for an LLM, a RAG pipeline, or a vector database, line breaks aren't just cosmetic. Chunking strategies typically split on paragraph boundaries (blank lines), so a document with mangled line breaks — hard-wrapped mid-sentence, or missing paragraph breaks entirely — gets chunked incorrectly. A paragraph split across three "sentence fragment" chunks retrieves worse than the same paragraph kept whole. We cover the chunking side of this in detail in Chunking Markdown for Vector Databases, and the line-break-specific failure mode — hard-wrapped prose from older document layouts — in how file2markdown checks its own output.
The Real Workflow: Converting Existing Documents
Writing Markdown by hand, you control line breaks directly. But most Markdown in production doesn't start as Markdown — it starts as a PDF, a Word document, an HTML export, or a scanned report, and something has to decide where the paragraph breaks go.
This is where naive converters fail. A PDF stores text as positioned lines on a page, not as semantic paragraphs, so a converter that treats every line as a new line break produces Markdown that's technically valid but reads as broken, hard-wrapped prose — every sentence chopped into fragments. file2markdown's conversion pipeline reconstructs paragraph structure instead of preserving positional line breaks literally, so a multi-line paragraph in your source PDF or Word file comes out as one clean paragraph in Markdown, not eight.
To see this in practice:
- Convert a document with PDF to Markdown, DOCX to Markdown, or HTML to Markdown.
- Check the output for hard-wrapped fragments — lines that end mid-sentence for no reason.
- If you need a literal
<br>preserved (for example, inside a table cell you're building manually), add it explicitly rather than relying on the converter to guess your intent from whitespace.
For a broader look at why clean paragraph structure matters beyond line breaks — tables, headings, and formatting choices that affect how well an LLM parses your document — see why Markdown works so well for AI and Markdown tables vs. HTML tables for RAG.
Frequently Asked Questions
Why doesn't pressing Enter once create a line break in Markdown?
Because Markdown's parser treats a single newline as whitespace, not as formatting. This is deliberate — it decouples how you wrap your source text from how it renders. Use trailing two spaces, a trailing backslash, or <br> to force an actual break.
What's the difference between a line break and a new paragraph in Markdown?
A line break keeps two lines inside the same paragraph (no extra vertical space, same block). A new paragraph — created with a blank line between blocks of text — starts a new block entirely, which most renderers space out visually and which most chunking pipelines treat as a split point.
Does GitHub Markdown support <br>?
Yes. GitHub Flavored Markdown renders inline HTML tags like <br> inside Markdown files, including inside table cells, where it's the only reliable way to force a line break since literal newlines break table syntax.
Why did my line breaks disappear after converting a PDF or Word file to Markdown?
Most likely the converter either stripped positional line breaks entirely or preserved every line as a hard break, producing fragmented paragraphs. A conversion pipeline that reconstructs semantic paragraph structure — rather than treating each visual line as a break — avoids both failure modes; that's what file2markdown's output-health checks are built to catch, described in our build-in-public post on the topic.
The Markdown Memo
A fortnightly note for lawyers, researchers, accountants, and anyone else drowning in PDFs, scans, and decks. No spam.