Written and tested by the MD Converter editorial team
Line Breaks in Markdown Table Cells: GFM and PDF
Line breaks inside GFM table cells with `<br>`—when it works, when sanitizers strip it, how to prevent PDF overflow, and design alternatives when cells get too long.
What you'll learn
- The main ways to break lines in GFM table cells
- When
<br>gets stripped by sanitizers and how to check - Width and overflow issues in PDF/print and how to avoid them
- PDF-friendly table design habits
- Alternatives when cells get too long for a table structure
Markdown tables (| and -) are widely used, but line breaks inside a cell are awkward in plain syntax. In GitHub Flavored Markdown (GFM), the most common fix is HTML <br> inside the cell—when the environment allows HTML. Some pipelines sanitize HTML away, so you may see breaks locally but not in production.
Main ways to break lines in cells
Option 1: <br> tag
Most GFM renderers respect <br> inside cells:
| Item | Description |
|------|-------------|
| Steps | Open the file<br>Review the content<br>Save and close |
Caveats: HTML may be forbidden by policy, and over-frequent breaks hurt readability and accessibility.
Option 2: Redesign the content
Split content across more table rows, or move long explanations to bullet lists outside the table. For business docs, clarity of structure often beats a dense grid.
Option 3: Consider width and wrapping
With many columns, cells get narrow and long alphanumeric tokens may not wrap, sticking out horizontally. Even with <br> stacking lines vertically, total width can exceed the page—reduce columns, change layout, or adjust fonts.
PDF-friendly habits
Print and PDF are not the same width as an arbitrary screen. Keep these three points:
- Fewer columns — stay within A4 printable width
- Concise header rows — long headers hurt column width
- No code blocks or large images in cells — they force row height and break pagination
Open print preview and check for horizontal overflow before you distribute the document.
Alternatives to tables
If a cell wants many lines of explanation, a table may be the wrong structure. Compare headings + lists, numbered steps, or definition-style layouts before committing. For meeting packs, short tables + detail on the next page is a common split.
Maintenance
Heavy <br> use makes re-editing painful when rows change. Team rules like "one short line per cell, long text elsewhere" help. Pasting from Excel often drops merged cells and embedded newlines—always preview after paste.
Diagnose the stage where the break disappears. If <br> is printed literally, raw HTML may be disabled or escaped. If the tag vanishes completely, a sanitizer probably removed it. If HTML looks correct but PDF layout breaks, inspect row height, the page boundary, and any rule that prevents the table from splitting.
Keep cell breaks to short, related lines. Adding many vertical breaks can solve width while creating an extremely tall row that paginates poorly. When a cell needs more than two or three compact lines, move the detail below the table and reference it with a short label.
FAQ
I added <br> to a cell but it doesn't break the line
Check: (1) Does the tool/site allow raw HTML? (Sanitizers may strip it.) (2) Is the parser GFM-compliant? (3) Is there no extra space around <br>?
Tables split across pages in PDF
Apply break-inside: avoid in print CSS when a short table should stay together. For large tables, consider landscape orientation or split the data into meaningful sections.
Can two trailing spaces replace <br> in a table cell?
Typically no—trailing-space hard breaks do not reliably work inside GFM table cells. <br> is the standard approach when HTML is allowed.
My Excel table had cell line breaks and now the Markdown looks wrong
Excel line breaks do not transfer to Markdown automatically. Always preview after pasting and replace with <br> as needed.
The table overflows on mobile
Narrow screens require horizontal scrolling for wide tables. Consider reducing column count or switching to a vertical list format for mobile-first documents.
Summary
<br> is convenient for GFM cells, but watch HTML policy and horizontal width. Consider non-table blocks for long prose. For final QA, check both narrow mobile width and A4 print preview. If you mix bold and links in cells, confirm your renderer applies Markdown inside cells as you expect—behavior varies. On responsive layouts where column width changes, do not rely on <br> alone; shorter text per cell is safer.
Try the tools
Check table rendering in Markdown to HTML, then print-oriented output in Markdown to PDF.
Related
- How-to & BlogWhy Markdown PDFs and Print Look Broken — Causes and FixesFix common Markdown-to-PDF and print issues—margins, breaks, missing backgrounds, font substitution, overflowing tables. Includes a triage checklist and browser comparison notes.Read article
- How-to & BlogWhy Markdown Line Breaks Don't Show — Causes and FixesLearn why one Enter does not create a Markdown line break, and choose correctly between blank lines, trailing spaces, backslashes, and `<br>`.Read article
- How-to & BlogUsing `<br>` for Line Breaks in Markdown — When It Works, When It Doesn'tWhen HTML `<br>` works in Markdown (GFM table cells, addresses), when sanitizers strip it, and when to prefer trailing-space or backslash hard breaks instead.Read article