Skip to content

How to Add a Line Break in a Markdown Table Cell

By MarkdownTables.com editorial teamUpdated

On this page

How do I add a new line in a table cell?

Write the whole row on one line and insert <br> at each break. Stack as many as you need.

Three lines in one cell with <br>
Markdown
| Environment | Server                                   |
| :---------- | :--------------------------------------- |
| Production  | AWS us-east-1<br>8 vCPU, 32 GB RAM<br>gp3 SSD |
| Staging     | AWS us-west-2<br>2 vCPU, 8 GB RAM<br>gp3 SSD  |
Preview
EnvironmentServer
ProductionAWS us-east-1
8 vCPU, 32 GB RAM
gp3 SSD
StagingAWS us-west-2
2 vCPU, 8 GB RAM
gp3 SSD

<br>, <br/> and <br /> are equivalent in HTML. Use <br /> if your Markdown goes through MDX (see below); otherwise pick one and stay consistent. The table formatter keeps the tags intact when it pads the columns.

Why pressing Enter breaks the table

In GitHub Flavored Markdown each line of the source is one table row. A newline inside a cell doesn't continue the cell; it ends the row, and the text after it becomes a new row (or ends the table if there is no pipe on the line). The usual Markdown hard breaks, two trailing spaces or a trailing backslash, don't apply either, because they need a newline after them. That leaves inline HTML, which the parser passes through as part of the cell.

Every way to get multiple lines in a cell

Multiline cell techniques and where they work
TechniqueSyntaxWorks onNotes
Line breakLine 1<br>Line 2GitHub, GitLab, Obsidian, VS Code, Jupyter, MkDocs, JekyllThe standard answer
Self-closing breakLine 1<br />Line 2Everywhere <br> works, plus MDXRequired in Docusaurus and other MDX setups
Blank line between paragraphsPara 1<br><br>Para 2Same as <br>Two breaks give a visible gap
Bulleted list<ul><li>A</li><li>B</li></ul>GitHub, GitLabKeep the whole list on one line
Text bullets• A<br>• BAnywhere <br> worksSimplest list that survives sanitizers
Multiline code<code>line 1<br>line 2</code>GitHub, GitLabOr one code span per line
Grid table+---+ borders, block content in cellsPandoc, QuartoReal paragraphs, lists and code blocks
HTML table<table> with Markdown inside <td>GitHub, GitLab, most sitesWhen cells need block content

Worked examples

Multiline header

Long headers make every row wide. Breaking the header moves the unit or qualifier onto a second line and keeps the column narrow.

A unit on its own line in the header
Markdown
| Region | Revenue<br>(USD, millions) | Growth<br>(year over year) |
| :----- | -------------------------: | -------------------------: |
| Europe |                      12.40 |                      +8.1% |
| Asia   |                       9.75 |                     +14.6% |
Preview
RegionRevenue
(USD, millions)
Growth
(year over year)
Europe12.40+8.1%
Asia9.75+14.6%

Code on several lines

A code span shows its contents literally, so <br> inside backticks prints as text. Close the code span before each break, or use the HTML <code> element, which does allow <br> inside it.

One code span per line, or an HTML <code> element
Markdown
| Task   | Commands                                   |
| :----- | :----------------------------------------- |
| Deploy | `git checkout main`<br>`npm run deploy`    |
| Test   | <code>npm ci<br>npm test</code>             |
Preview
TaskCommands
Deploygit checkout main
npm run deploy
Testnpm ci
npm test

Paragraphs in a cell

Two <br> tags leave a blank line
Markdown
| Decision | Rationale |
| :------- | :-------- |
| Use PostgreSQL | Mature JSON support.<br><br>The team already runs it in production. |
Preview
DecisionRationale
Use PostgreSQLMature JSON support.

The team already runs it in production.

Lists in a cell

Markdown list markers (-, 1.) can't start a line inside a cell, so lists need HTML. On GitHub and GitLab, an inline <ul> or <ol> works if the whole list is on the row's line. Text bullets with <br> are the fallback for renderers that strip list tags.

HTML list vs. text bullets
Markdown
| Plan | Includes |
| :--- | :------- |
| Pro  | <ul><li>Unlimited tables</li><li>Custom CSS export</li></ul> |
| Team | • Everything in Pro<br>• Shared workspaces |
Preview
PlanIncludes
Pro
  • Unlimited tables
  • Custom CSS export
Team• Everything in Pro
• Shared workspaces

Stopping a line from wrapping

The opposite problem: renderers wrap long cells to fit the page, which can split a command or a name. Replace the spaces that must not break with &nbsp;. Entities are not decoded inside backtick code spans, so for code use the HTML <code> element instead, or give the column more room (see column width).

Non-breaking spaces keep words together
Markdown
| Command | Effect |
| :------ | :----- |
| <code>git&nbsp;push&nbsp;--force-with-lease</code> | Push, but refuse if the remote moved |
| git&nbsp;push&nbsp;origin&nbsp;main | Push the main branch |
Preview
CommandEffect
git push --force-with-leasePush, but refuse if the remote moved
git push origin mainPush the main branch

Inside backticks   would print literally; the HTML <code> element decodes it.

Open in editor : Non-breaking spaces keep words together

Line break support by platform

Line breaks and multiline cells by platform
Platform`<br>` in cellsBlock content in cells
GitHub (GFM)<br>, <br/>, <br /> and inline <ul><li> all render in cells.YesNo: HTML table
GitLab (GLFM)Same as GitHub for <br> and HTML lists.YesNo: HTML table
ObsidianReading view and Live Preview render <br>.YesNo
VS Code previewThe built-in preview renders inline HTML.YesNo
JupyterMarkdown cells render inline HTML.YesNo
Pandoc / QuartoRaw HTML passes through to HTML output and is dropped from LaTeX/PDF and DOCX.Partly: HTML output onlyYes: Grid tables
Hugo (Goldmark)Raw HTML is omitted by default.Partly: Needs unsafe = trueNo
Docusaurus (MDX)MDX is JSX, so tags must be closed.Partly: Write <br />No
MkDocs, JekyllPython-Markdown and kramdown pass inline HTML through.YesNo
RedditNo inline HTML, so no way to break a line in a cell.NoNo
ChatGPT, Cursor chatChat renderers often skip raw HTML.Partly: May show <br> as textNo

✅ supported · ⚠️ partly or with a workaround · ❌ not supported · Last verified October 2026

“Block content” means real paragraphs, lists or code blocks written in Markdown. Where it says HTML table, write the whole table in HTML.

Hugo shows nothing where the <br> was

Hugo's Markdown renderer, Goldmark, drops raw HTML by default and leaves an <!-- raw HTML omitted --> comment in its place, so the two lines run together. Enable raw HTML in the site config:

TOML
# hugo.toml
[markup.goldmark.renderer]
  unsafe = true
YAML
# hugo.yaml
markup:
  goldmark:
    renderer:
      unsafe: true

“Unsafe” means Hugo stops filtering any HTML in your content. That is fine for a site where you write the Markdown yourself; think twice if the content comes from untrusted contributors.

Docusaurus and MDX: write <br />

Docusaurus compiles .md and .mdx files with MDX by default, and MDX treats HTML as JSX, where every tag must be closed. An unclosed <br> fails the build with an error about a missing closing tag. Use the self-closing form:

MDX-safe line break
Markdown
| Step    | Details                         |
| ------- | ------------------------------- |
| Install | Download it<br />Run setup      |
Preview
StepDetails
InstallDownload it
Run setup

The same applies to Next.js MDX, Astro MDX and any other MDX pipeline.

ChatGPT, Cursor and other chat UIs show <br> as text

AI chat interfaces render Markdown tables but often don't render raw HTML, so a table with <br> may display the tag as text there. If you are asking a model for a table you will read in the chat, ask it to avoid HTML and keep one value per cell, or separate items with semicolons. If the table is going into a README or docs, the <br> version is right; it will render once it is on GitHub or your site.

Real multiline cells: Pandoc grid tables

Pandoc (and Quarto, which uses it) is the one widely used toolchain with true multiline cells. In a grid table each cell is a small Markdown document: blank lines make paragraphs, and lists and code blocks work.

Pandoc grid tableMarkdown
+---------+---------------------------+
| Step    | Details                   |
+=========+===========================+
| Install | Run the installer.        |
|         |                           |
|         | Restart when it finishes. |
+---------+---------------------------+
| Ship    | - Tag the release         |
|         | - Publish the notes       |
+---------+---------------------------+

Pandoc's multiline tables also let a row span several source lines, but the lines are joined into one paragraph, so they help with long text rather than hard breaks. In pipe tables, Pandoc treats <br> as raw HTML: it reaches HTML output and is dropped from LaTeX, PDF and Word output. The Pandoc tables guide covers all four table styles.

Pasting cells with line breaks from Excel or Sheets

A spreadsheet cell with a line break inside (Alt+Enter in Excel, Ctrl+Enter in Google Sheets) is copied as a quoted value containing a real newline. Paste that into a hand-written table and the row splits in two. The Excel to Markdown converter and the CSV converter turn those newlines into <br> for you, so paste the cells there instead.

Common mistakes (broken vs. fixed)

Pressing Enter inside a cell

Broken: the second line becomes its own row
Markdown
| Step | Task |
| :--- | :--- |
| 1    | Download installer
Run setup wizard |
| 2    | Launch the app |
Preview
StepTask
1Download installer
Run setup wizard
2Launch the app

GFM reads Run setup wizard | as a new row with an empty second cell.

Fixed: <br> keeps it in one cell
Markdown
| Step | Task |
| :--- | :--- |
| 1    | Download installer<br>Run setup wizard |
| 2    | Launch the app |
Preview
StepTask
1Download installer
Run setup wizard
2Launch the app

Typing \n

Broken: \n is printed as-is
Markdown
| Name | Description     |
| :--- | :-------------- |
| Auth | Step 1\nStep 2 |
Preview
NameDescription
AuthStep 1\nStep 2

Markdown has no \n escape. Use <br> as in the fixed example above.

Open in editor : Broken: \n is printed as-is

A break inside backticks

Broken: the tag shows inside the code span
Markdown
| Task  | Commands                     |
| :---- | :--------------------------- |
| Build | `npm ci<br>npm run build` |
Preview
TaskCommands
Buildnpm ci<br>npm run build
Fixed: one code span per line
Markdown
| Task  | Commands                         |
| :---- | :------------------------------- |
| Build | `npm ci`<br>`npm run build` |
Preview
TaskCommands
Buildnpm ci
npm run build

The table validator catches rows that were split by a stray newline.

When to switch to an HTML table

<br> is right for two or three short lines. When a cell needs real structure, such as numbered steps, a fenced code block or several paragraphs, write the table in HTML. On GitHub and GitLab you can still use Markdown inside a <td> if you leave a blank line after the opening tag and before the closing one:

HTML table with Markdown block content in a cellHTML
<table>
  <tr>
    <th>Step</th>
    <th>Details</th>
  </tr>
  <tr>
    <td>Install</td>
    <td>

1. Download the installer.
2. Run it.

```sh
./install.sh --prefix ~/.local
```

</td>
  </tr>
</table>

Other options: move the detail out of the table and link to it, or hide a long table in a collapsible section. For pipes inside cells, see escaping pipes; for everything else, the Markdown table syntax guide.

Frequently asked questions

How do I add a line break in a Markdown table cell?

Type <br> where the line should break: | Line one<br>Line two |. Pressing Enter ends the row, so HTML is the only way. It works on GitHub, GitLab, Obsidian, VS Code and most site generators.

Should I write <br>, <br/> or <br />?

<br> is the usual choice and works on GitHub, GitLab and Obsidian. Use <br /> if the file is processed as MDX (Docusaurus, Next.js MDX), where an unclosed <br> is a compile error. <br /> works everywhere <br> does.

How do I make a multiline header in a Markdown table?

Use <br> in the header cell, for example | Revenue<br>(USD) |. Header cells accept the same inline content as data cells.

Can I put a bulleted list in a Markdown table cell?

Not with Markdown list syntax. On GitHub and GitLab, write the list as inline HTML on one line: <ul><li>One</li><li>Two</li></ul>. Elsewhere, use • One<br>• Two.

Why does <br> show up as text in my table?

The renderer is escaping raw HTML. Hugo does this unless markup.goldmark.renderer.unsafe is true; Reddit and many chat interfaces never render HTML. Inside backticks <br> is also literal, so close the code span before the break.

Can a Markdown table row span multiple lines in the source?

Not in GFM: every row is exactly one line. Pandoc and Quarto offer multiline and grid tables whose rows span several source lines, and grid tables can hold lists and paragraphs.

How do I stop text from wrapping in a table cell?

Replace the spaces with &nbsp; (non-breaking spaces), for example git&nbsp;push in plain text or inside an HTML <code> element (not inside backticks). Renderers wrap long cells to fit the page, and a non-breaking space keeps those words on one line.