Need AI Training/Help?CloudYeti.io/meet
MarkdownMe
Practical Markdown Guide

Can Markdown Tables Merge Cells?

Standard Markdown table syntax does not provide colspan or rowspan controls, so it cannot merge cells in a portable way. Many pipe-table extensions require one cell per column on each row. If the renderer allows raw HTML, use `colspan` to span columns or `rowspan` to span rows inside an HTML table. Otherwise, redesign the table with repeated labels, separate tables, or a simpler layout. Test the final renderer because some platforms remove table attributes or reject raw HTML.

What pipe tables can and cannot represent

A common Markdown table uses pipes for cells and a delimiter row for the header. For example, `| Plan | Price |` and `| --- | --- |` define two columns. The syntax does not include a portable marker for a cell that covers two columns. Adding extra pipes, leaving cells blank, or inserting HTML attributes into a pipe row may produce malformed output. Some processors offer table extensions, but merged-cell support is unusual and varies by implementation. The same source can render differently in a repository, static-site generator, chat application, and Markdown editor.

Merge cells with HTML when allowed

HTML tables support `colspan` and `rowspan`. A cell spanning two columns looks like `<td colspan="2">Total</td>`. A cell spanning two rows looks like `<td rowspan="2">North</td>`. Here is a small structure: `<table><tr><th scope="col">Region</th><th scope="col">Q1</th><th scope="col">Q2</th></tr><tr><th scope="row">North</th><td colspan="2">Pending</td></tr></table>`. Use valid table structure and keep the number of occupied columns consistent in every row. Raw HTML may be disabled or sanitized. CSS can affect borders and width, but CSS does not add missing table semantics.

Consider readability and accessibility

Merged cells can make a report compact, but they increase the work required to understand relationships between headers and values. Use `th` for cells that label a row or column, and add `scope` where it clarifies that relationship. Complex tables may need an explicit caption, an explanatory paragraph, or a different presentation. Repeat a category in each row when the table will be copied into plain text or converted into another format. On small screens, wide tables may scroll horizontally or wrap in confusing ways. Inspect the generated HTML, keyboard behavior, screen-reader announcements, print layout, and mobile view. A Markdown table generator may export HTML correctly while its Markdown output cannot preserve the merge.

How do you do it step by step?

  1. 1List the intended rows, columns, and cells that should span more than one position.
  2. 2Confirm whether the target Markdown processor supports raw HTML and preserves table attributes.
  3. 3Use HTML with `colspan` or `rowspan` when merged cells are necessary.
  4. 4Add headers, scopes, captions, and repeated labels so the relationships remain understandable.
  5. 5Test the published table in the actual renderer and in narrow, printed, and assistive views.

Working example

This example uses one header row and a status cell that spans the two data columns.

Input
<table><tr><th scope="col">Item</th><th scope="col">Q1</th><th scope="col">Q2</th></tr><tr><th scope="row">Service</th><td colspan="2">Scheduled</td></tr></table>
Result
The Scheduled cell occupies the Q1 and Q2 positions in the second row.

The HTML must survive the Markdown host. If it does not, repeat the value in separate cells or restructure the data.

Frequently asked questions

Can Markdown pipes merge two cells?
Not with portable pipe-table syntax. Pipes separate cells, but the syntax does not define colspan or rowspan.
What does colspan do?
The HTML `colspan` attribute makes one table cell occupy multiple columns in the same row.
What does rowspan do?
The HTML `rowspan` attribute makes one table cell occupy multiple rows in the same column.
What if my platform strips HTML?
Repeat labels or values, split the complex table into simpler tables, or use a list that preserves the relationships without merged cells.

Official references