---
menu-title: Basics
meta-title: Tables overview | CKEditor 5 Documentation
meta-description: Create and customize tables in CKEditor 5 to organize data effectively with support for merging cells, headers, and responsive layouts.
category: tables
order: 10
modified_at: 2025-11-14
---

# Tables in CKEditor&nbsp;5 (overview)

{@snippet features/build-table-source empty}

The table feature provides tools for creating and editing tables. Tables are great for organizing data in a clear, visually appealing way or creating structured content. They are also great for making document layouts for applications such as newsletters or email editors. There are two basic types of tables available: content tables, described in this feature guide, and {@link features/layout-tables layout tables} used to organize the content rather than present tabular data. You can easily {@link features/layout-tables#table-toggling switch between these two types}.

## Demo

Use the insert table button {@icon @ckeditor/ckeditor5-icons/theme/icons/table.svg Insert table} to insert a new table into the content. Click inside the table to open a contextual toolbar. The toolbar lets you add or remove columns {@icon @ckeditor/ckeditor5-icons/theme/icons/table-column.svg Table column} and rows {@icon @ckeditor/ckeditor5-icons/theme/icons/table-row.svg Table row}. You can also merge or split cells {@icon @ckeditor/ckeditor5-icons/theme/icons/table-merge-cell.svg Table cell}.

Try toggling the caption on and off {@icon @ckeditor/ckeditor5-icons/theme/icons/caption.svg Table caption}. You can also change the properties of the entire table {@icon @ckeditor/ckeditor5-icons/theme/icons/table-properties.svg Table properties} or individual cells {@icon @ckeditor/ckeditor5-icons/theme/icons/table-cell-properties.svg Cell properties}. To control the width of a column, click and drag its edge.

{@snippet features/tables}

You may look for more interesting details in the [Tables in CKEditor&nbsp;5](https://ckeditor.com/blog/feature-of-the-month-tables-in-ckeditor-5/) blog post after reading this guide.

## Basic table features

The basic table features allow users to insert tables into content, add or remove columns and rows and merge or split cells.

The [`@ckeditor/ckeditor5-table`](https://www.npmjs.com/package/@ckeditor/ckeditor5-table) package contains multiple plugins that implement various table-related features. The {@link module:table/table~Table `Table`} plugin is at the core of the ecosystem and it provides the table functionality. There are many other features that extend the editor capabilities:

## Table selection

The {@link module:table/tableselection~TableSelection} plugin introduces support for the custom selection system for tables that lets you:

* Select an arbitrary rectangular table fragment &ndash; a few cells from different rows, a column (or a few of them) or a row (or multiple rows).
* Apply formatting or add a link to all selected cells at once.

The table selection plugin is loaded automatically by the `Table` plugin and can be tested in the [demo above](#demo).

## Table alignment

You can move tables horizontally to create a desired document layout. There are five alignment options in tables:

* Left (block) {@icon @ckeditor/ckeditor5-icons/theme/icons/object-left.svg Table cell aligment}: A table aligns to the left. The table does not influence the flow of other content.
* Center {@icon @ckeditor/ckeditor5-icons/theme/icons/object-center.svg Table cell aligment}: A table is horizontally centered, with equal amounts of space on both sides.
* Right (block) {@icon @ckeditor/ckeditor5-icons/theme/icons/object-right.svg Table cell aligment}: A table is aligned to the right. The table does not influence the flow of other content.
* Left (wrap) {@icon @ckeditor/ckeditor5-icons/theme/icons/object-inline-left.svg Table cell aligment}: A table aligns to the left, and other content wraps around it.
* Right (wrap) {@icon @ckeditor/ckeditor5-icons/theme/icons/object-inline-right.svg Table cell aligment}: A table aligns to the right, and other content wraps around it.

{@img assets/img/table-alignment-options.png 600 Table alignment options}

You can find all of those options in the [table properties balloon](#table-contextual-toolbar). The balloon displays after you click on a table. Use the [demo above](#demo) to test all those options.

You can also control how the alignment appears in the editor's output. Learn more about it in the {@link features/tables-installation#table-alignment-in-output Table alignment in output} section.

## Table cell type

Two types of table cells can contain content: data cells (the default type) and header cells. Header cells provide semantic labelling for rows or columns, helping the browser or a screen reader understand the data arrangement and relations.

To change cell type, click the cell and use the cell properties icon {@icon @ckeditor/ckeditor5-icons/theme/icons/table-cell-properties.svg Table cell properties} from the table toolbar. Once there, choose the desired cell type.

{@img assets/img/table-cell-type.png 605 Table cell type}

To create a header row or column in your table, select all cells in the row or column and change their type to header. You will see the type change automatically in the row/column property dialog.

{@img assets/img/table-row-property.png 300 Table row type}

<info-box tip>
	It is easier to use the row/column property dialog to change these into headers, rather than use the cell property method.
</info-box>

## Table cell scope

Header cells can use the `scope` attribute to explicitly associate themselves with the related row or column, which helps screen readers understand the table structure.

This attribute is available only for header cells and is enabled by default. The editor assigns the `scope` attribute automatically based on a header cell's position. If you prefer, you can change it manually in the cell properties balloon. The dropdown offers two explicit options:

* **Column header** – forces a header cell to describe the column and sets `scope="col"`.
* **Row header** – forces a header cell to describe the row and sets `scope="row"`.

To disable this behavior, set the {@link module:table/tableconfig~TableCellPropertiesConfig#scopedHeaders `config.table.tableCellProperties.scopedHeaders`} configuration option to `false`.

## Typing around tables

To type before or after a table easily, select the table, then press the Arrow key (<kbd>←</kbd> or <kbd>→</kbd>) once, depending on where you want to add content &ndash; before or after. The table is no longer selected and whatever text you type will appear in the desired position.

## Nesting tables

CKEditor&nbsp;5 allows nesting tables inside other table's cells. This may be used for creating advanced charts or layouts based on tables. The nested table can be formatted just like a regular one.

### Demo

<!-- We may reconsider this demo, as the feature will still work in the first one -->

You can test this feature in the demo below by adding a new table in the blank "abandoned" section at the bottom of the existing table. Click inside a cell and use the insert table button {@icon @ckeditor/ckeditor5-icons/theme/icons/table.svg Insert table}. A nested table will appear inside the cell.

{@snippet features/table-nesting}

<snippet-footer>
	This demo presents a limited set of features. Visit the {@link examples/builds/full-featured-editor feature-rich editor example} to see more in action.
</snippet-footer>

### Known issues

While table nesting is fully functional, the Markdown code generated with the {@link features/autoformat Markdown output} feature will not properly render nested tables ([#9475](https://github.com/ckeditor/ckeditor5/issues/9475)). Feel free to upvote 👍&nbsp; this issue on GitHub if it is important for you.

## Table contextual toolbar

The {@link module:table/tabletoolbar~TableToolbar} plugin introduces a contextual toolbar for table. The toolbar appears when a table or a cell is selected and contains various table-related buttons. These would typically include add or remove columns {@icon @ckeditor/ckeditor5-icons/theme/icons/table-column.svg Table column} and rows {@icon @ckeditor/ckeditor5-icons/theme/icons/table-row.svg Table row} and merge or split cells {@icon @ckeditor/ckeditor5-icons/theme/icons/table-merge-cell.svg Table cell}. If these features are configured, the toolbar will also contain buttons for captions {@icon @ckeditor/ckeditor5-icons/theme/icons/caption.svg Table caption} and table {@icon @ckeditor/ckeditor5-icons/theme/icons/table-properties.svg Table properties} and cell {@icon @ckeditor/ckeditor5-icons/theme/icons/table-cell-properties.svg Cell properties} properties.

{@img assets/img/table-toolbar.png 569 An extended contextual toolbar.}

The table selection plugin is loaded automatically by the `Table` plugin and can be tested in the [demo above](#demo). Learn more about configuring a contextual toolbar in the {@link features/tables-installation#toolbars Common API section}.

## Block vs inline content in table cells

The table feature allows for creating block content (like paragraphs, lists, headings, etc.) inside table cells. However, if a table cell contains just one paragraph and this paragraph has no special attributes (like text alignment), the cell content is considered "inline" and the paragraph is not rendered.

This means that a table cell can have two states: with inline content or with block content. The reason for this differentiation is that most tables contain only inline content (like the [demo](#demo) above) and it is common for "data tables" to not contain any block content. In such a scenario, printing out `<p>` elements would be semantically wrong and also unnecessary. There are, however, scenarios where the user wants to create, for example, a list inside a table cell and then the support for block content is necessary.

<info-box>
	"Rendering" here refers to the view layer. In the model, a cell is always filled with at least a `<paragraph>`. This is because of consistency, as &ndash; since a cell always has some block content &ndash; the text is never directly inside the `<tableCell>`. This also allows features like <kbd>Enter</kbd> support to work out of the box (since a `<paragraph>` exists in the model, it can be split despite the fact that it is not present in the view).
</info-box>

### Inline content

The following is the model representation of table cells with inline content only (a single `<paragraph>` inside):

```html
<table>
	<tableRow>
		<tableCell>
			<paragraph>Foo</paragraph>
		</tableCell>
		<tableCell>
			<paragraph>Bar</paragraph>
		</tableCell>
	</tableRow>
</table>
```

The above model structure will be rendered to the {@link module:editor-classic/classiceditor~ClassicEditor#getData data} as:

```html
<figure class="table">
	<table>
		<tbody>
			<tr>
				<td>Foo</td>
				<td>Bar</td>
			</tr>
		</tbody>
	</table>
</figure>
```

In the editing view (the editable container in which the user edits the content), additional `<span>` elements are created to compensate for the hidden `<paragraph>` elements:

```html
<figure class="table">
	<table>
		<tbody>
			<tr>
				<td><span>Foo</span></td>
				<td><span>Bar</span></td>
			</tr>
		</tbody>
	</table>
</figure>
```

### Block content

If a table cell contains any other block content than a single `<paragraph>` with no attributes, these block elements will be rendered.

The following is a sample table with some block content (model representation):

```html
<table>
	<tableRow>
		<tableCell>
			<paragraph>Foo</paragraph>
			<paragraph>Bar</paragraph>
		</tableCell>
		<tableCell>
			<heading1>Some title</heading1>
		</tableCell>
		<tableCell>
			<paragraph textAlign="right">Baz</paragraph>
		</tableCell>
	</tableRow>
</table>
```

The above model structure will be rendered to the data and to the editing view as:

```html
<figure class="table">
	<table>
		<tbody>
			<tr>
				<td>
					<p>Foo</p>
					<p>Bar</p>
				</td>
				<td>
					<h2>Some title</h2>
				</td>
				<td>
					<p style="text-align: right;">Baz</p>
				</td>
			</tr>
		</tbody>
	</table>
</figure>
```

<info-box info>
	At the moment, it is not possible to completely disallow block content in tables. See the [discussion on GitHub](https://github.com/ckeditor/ckeditor5-table/issues/101) about adding a configuration option that would enable that. Feel free to upvote 👍&nbsp; if this feature is important to you.
</info-box>

## Contribute

The source code of the feature is available on GitHub at [https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-table](https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-table).
