Markdown Table Merge Cells

Learn how to create tables with merged cells in Markdown

Important Note

Standard Markdown does not support merged cells (colspan/rowspan). To merge cells, you need to use HTML tables within your Markdown document.

Table Size

<table>
  <thead>
    <tr>
      <th>Header 1</th>
      <th>Header 2</th>
      <th>Header 3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td rowspan="2">Merged Row</td>
      <td colspan="2">Merged Column</td>
    </tr>
    <tr>
      <td>Cell 2-2</td>
      <td>Cell 2-3</td>
    </tr>
    <tr>
      <td>Cell 3-1</td>
      <td>Cell 3-2</td>
      <td>Cell 3-3</td>
    </tr>
  </tbody>
</table>
Header 1 Header 2 Header 3
Merged Row Merged Column
Cell 2-2 Cell 2-3
Cell 3-1 Cell 3-2 Cell 3-3

How to Merge Cells in Markdown Tables

Since standard Markdown doesn't support cell merging, you have two options:

Option 1: Use HTML Tables

HTML tables work in most Markdown renderers (GitHub, GitLab, etc.):

<table>
  <tr>
    <td colspan="2">Merged across 2 columns</td>
  </tr>
  <tr>
    <td rowspan="2">Merged 2 rows</td>
    <td>Cell</td>
  </tr>
  <tr>
    <td>Cell</td>
  </tr>
</table>

Option 2: Restructure Your Data

Sometimes you can avoid merged cells by reorganizing your content:

  • Use multiple tables instead of one
  • Add descriptive headers
  • Use nested lists for hierarchical data

HTML Merge Attributes

  • colspan="n" - Merge n columns horizontally
  • rowspan="n" - Merge n rows vertically