LaTeX table generator (and Markdown / HTML)

Paste a table from Excel, Origin or Google Sheets, open a CSV or XLSX file, or type in the grid. Edit it, then copy a publication-ready LaTeX table (booktabs by default), or the Markdown or HTML version. It runs in your browser: your data never leaves your computer.

Loading…

How to turn an Excel table into LaTeX

Select the cells in Excel, Origin or Google Sheets and copy them (Ctrl+C). Click on this page, then press Ctrl+V: the table appears in the grid above and the LaTeX code appears below it. Merged cells are kept. You can also open a .csv, .tsv or .xlsx file with the button, or drop it on the tool.

  1. Check the header rows. The first row is taken as the header; a two-level header needs the number set to 2.
  2. Set the alignment of each column in the box under its letter: left for text, centre or right for numbers, Decimal to line numbers up on the decimal point.
  3. Merge cells for a spanning header: click one cell, Shift+click another, press Merge.
  4. Choose the options (caption, label, float, font size) and copy the code. The \usepackage lines your table needs are listed in a separate box above the code.

The table is kept in your browser, so a reload does not lose it. Press Clear to remove it.

Why booktabs: the style journals prefer

The default output uses the booktabs package: a thick rule above and below the table (\toprule, \bottomrule) and a thin one under the header (\midrule), with no vertical lines. Publishers' style guides ask for this layout because it reads more easily and lets the numbers carry the table; the plain \hline grid is available as an alternative when a template insists on it. A typical result:

\begin{table}[htbp]
  \centering
  \caption{Lattice parameters.}
  \label{tab:lattice}
  \begin{tabular}{lcc}
    \toprule
    Sample  & $a$ (\AA) & $c$ (\AA) \\
    \midrule
    LiCoO2  & 2.816     & 14.052    \\
    \bottomrule
  \end{tabular}
\end{table}

Add \usepackage{booktabs} to the preamble of your document. Use table* instead of table when the table must span both columns of a two-column journal template.

Wrapping long text in a column

The column types l, c and r never wrap, so a long entry pushes the table past the margin. Two fixes:

Aligning decimals with siunitx

Numbers with different numbers of digits look untidy when centred. Set a column to Decimal (S) and it becomes an S column of the siunitx package, which lines the decimal points up. The generator reads the numbers of the column and writes a matching table-format, for example S[table-format=2.3(1)] for values such as 14.052(2), so the uncertainty in brackets lines up too. Cells that are not numbers, such as a header or n/a, are wrapped in braces, as siunitx requires. Add \usepackage{siunitx} to the preamble.

Merged cells: multicolumn and multirow

A header that spans several columns is written with \multicolumn{3}{c}{Lattice parameters}, a cell that spans several rows with \multirow{2}{*}{Sample} (package multirow). With booktabs, a short rule under the spanning header is added with \cmidrule(lr){2-4}. Merge the cells in the grid and all of this is written for you. Markdown has no merged cells: the Markdown tab keeps the text in the first cell of the block and says so.

Special characters in LaTeX tables

Ten characters have a meaning in LaTeX and break the build when they appear in a cell. The generator escapes them:

You typeLaTeX written
&\&
%\%
$\$
#\#
_\_
{ and }\{ and \}
~\textasciitilde{}
^\textasciicircum{}
\\textbackslash{}

Common symbols are converted too: ±, ×, Å, the minus sign − (U+2212, which pdflatex does not know), Greek letters such as θ, and subscript digits as in Li₂O. If you already wrote maths, such as $T_c$, tick Keep $math$ as typed and the text between dollar signs is left alone.

Markdown tables

A Markdown (GitHub style) table has a header row, a separator row, and one line per row. The colons in the separator set the alignment:

| Sample | a (Å) | Size (nm) |
| :----- | ----: | :-------: |
| LiCoO2 | 2.816 |        42 |

:-- is left, :-: is centred and --: is right. A pipe character inside a cell is written \|, and a line break inside a cell <br>. The Markdown tab does both. You can also paste a Markdown table into the box to turn it into LaTeX or HTML.

HTML tables

The HTML tab writes a plain <table> with <thead> and <tbody>, colspan and rowspan for merged cells, and no styling except text-align where a column is not left-aligned, so your own stylesheet decides how it looks.

Frequently asked questions

How do I make a long text column wrap in a LaTeX table?

Use a paragraph column. Either give the column a fixed width, p{4cm}, or load the tabularx package and use an X column inside \begin{tabularx}{\linewidth}{lXc}, which takes all the width the other columns leave. In this generator set the alignment of that column to Wrap (X); the tabularx package line is added to the preamble for you.

How do I convert a CSV file to a LaTeX table?

Click Open CSV / TSV / XLSX and choose the file, or paste its contents into the box. The comma, semicolon or tab separator is detected automatically. Check the header rows and the alignment of each column, then copy the LaTeX code from the LaTeX tab.

How do I convert an Excel table to LaTeX?

Select the cells in Excel, press Ctrl+C, click on this page and press Ctrl+V. Merged cells are kept. You can also open the .xlsx file directly. Then copy the LaTeX code, and add the \usepackage lines shown above it to your preamble.

How do I make a table in Markdown?

A Markdown table is a header row, a separator row of dashes whose colons set the alignment (:-- left, :-: centre, --: right), and one line per row, with cells separated by pipes. Paste your cells here and open the Markdown tab to get exactly that, with any pipe characters in your data escaped.

Why does my LaTeX table run off the page?

The columns are wider than the text block, usually because of long text in l, c or r columns, which never wrap. Make the long column a wrapping column (p{4cm} or an X column in tabularx), reduce the font size with \small or \footnotesize, or use a table* float to span two columns in a two-column journal layout.

Is my data uploaded?

No. Everything runs in your browser; the table is never sent to a server. It is kept in your browser's local storage so a reload does not lose it, and the Clear button removes it.