↧ Expand ↧↥ Collapse ↥
Result (updated automatically as you edit the table)

LaTeX Tables Generator

How to use the LaTeX tables generator?

  1. Enter the data. Copy cells from a spreadsheet (Excel, Google Sheets, LibreOffice Calc) or a table on a web page, click a cell and press Ctrl+V: the table grows to fit them. Or click a cell and type: typing replaces its text, while a double click or Enter edits the text that is there (Esc or a click elsewhere ends the edit). Tab and the arrow keys move to the next cell; Tab in the last cell adds a row. Add a row or a column at the end with the + under or right of the table, and add and remove them anywhere with the Row and Column menus, or by right-clicking a cell. You can also import an Excel workbook or a CSV file with File / Import CSV or Excel file, or drop it on the table.
  2. Format it. Select cells by clicking them, by dragging over them or with Shift and the arrow keys (Ctrl+click adds a cell), then merge them, align their text, make it bold or italic and add or remove borders with the toolbar and the Table and Cell menus.
  3. Copy the code. The table's LaTeX code appears under the editor as you edit: click Copy to clipboard and paste it into your document. The options under the code set its style, caption, placement and width; the packages the table needs are named in a comment at its top.

To edit a table you already have in LaTeX, copy its code, click a cell and press Ctrl+V: the table is read from the code, with its merged cells, rules, colours and caption. File / Import LaTeX code does the same.

To write the code yourself, see our LaTeX tables cheat sheet: examples of lines, merged cells, column widths, colours, captions and long tables, each with the table that LaTeX makes from it. New to LaTeX tables? Our guide How to make a table in LaTeX builds one step by step, and Excel to LaTeX shows how to convert a table from a spreadsheet.

Standard or booktabs style?

For more professional looking tables, try the booktabs style (Style: Booktabs in the options under the code). Its tables look like those in books and scientific articles:

  • no vertical rules,
  • more space above and below the horizontal rules,
  • a thicker rule at the top and the bottom of the table than between its rows, and no double rules.

The table's horizontal borders become the rules: the top border \toprule, the bottom one \bottomrule and the others \midrule (\cmidrule under some columns only). So give the table a top and a bottom border, e.g. with Table / Add horizontal borders.

Long text in a column

A column is as wide as its longest text. To wrap its text, give the column a width: drag the right edge of its header above the table, or right-click the header and choose Set column width (double-click the edge to make the column as wide as its text again). It becomes a p{} column of that width. To make the table as wide as the text on the page, choose Width: Wrap to text width in the options: the columns with a width share what the other columns leave of it (a tabularx table). Scaling the table to the text width shrinks its text too, which most style guides advise against.

Special characters and LaTeX commands

Characters with a special meaning in LaTeX, such as %, &, _, # or $, are escaped, so the cells print as typed. To write LaTeX in the cells, e.g. math ($x^2$) or \cite{key}, uncheck Escape special characters in the options.

Convert Excel, Word or CSV to LaTeX

Select the cells in Excel, Google Sheets or LibreOffice Calc and copy them. Click the top left cell of the editor and press Ctrl+V. The merged cells, bold text, alignment, colours and borders come with the cells. A table copied from Word, Google Docs or a web page pastes the same way. For a whole file, select File / Import CSV or Excel file: it reads .csv files and Excel workbooks (.xlsx), and asks which sheet to import when there are several.

It also works the other way. To move a LaTeX table to Excel, copy its code, click a cell of the editor and press Ctrl+V. Then press Ctrl+A to select all cells and Ctrl+C to copy them, and paste them in the spreadsheet. Or select File / Download as CSV.

Use the table in Overleaf

To see the table typeset, click Open in Overleaf next to Copy to clipboard. It opens the table in Overleaf as a new project, in a new browser tab: a complete document with the packages the table needs, which Overleaf compiles. The table's code is sent to Overleaf only when you click the button.

To put the table in a document you already have:

  1. Click Copy to clipboard and paste the code in your .tex file where the table goes, between \begin{document} and \end{document}.
  2. If the code starts with Please add the following required packages to your document preamble, copy each \usepackage line under it to the preamble, the part above \begin{document}. Remove the % at the start of the line.

To try the table on its own in another LaTeX editor, such as TeXstudio, check Complete document in the options. The code is then a whole document with its packages.

Common problems

Undefined control sequence, at \toprule, \multirow or \cellcolor
A package is missing. Add the \usepackage lines from the comment at the top of the code to your preamble.
The table is at the top of the page, or on the next page
A table environment is a float: LaTeX puts it where it fits best. The empty [] after \begin{table} uses LaTeX's default places. Write [h] in it to keep the table where it is in the text when it fits there, or [!htbp] to let LaTeX try harder.
The table is wider than the page
Choose Width: Wrap to text width to wrap the text of long columns, or give a column a width (see Long text in a column). A table of many short columns gets narrower with Text size: Small and Column gap: Narrow. Rotate to a landscape page gives a wide table a page of its own.
The table is wider than a column of a two-column document
Check Span both columns of a two-column document under Placement: the table is then as wide as both columns, at the top of a page (a table*).
The rows are too close together
Choose a Row height of 1.2× or 1.5× under Spacing.
The table does not fit on one page
Check Split across pages under Long table. The table continues on the next page, and it can repeat its header rows there.

Other table formats

The same editor makes tables for HTML, Markdown, plain text, Typst, MediaWiki and AsciiDoc. Open another format's page in the same browser tab, and the table is there; File / Recent tables lists the tables you made before. Our guides show how to make tables in each format by hand.