LaTeX table generator
Fill in the grid or paste cells from Excel (or an existing LaTeX table) and get code that compiles first time: booktabs, tabularx or longtable, with a caption, a label, landscape and scaling options.
Fill in the grid or paste cells from Excel (or an existing LaTeX table) and get code that compiles first time: booktabs, tabularx or longtable, with a caption, a label, landscape and scaling options.
\begin{table}[htbp]: the float, which lets LaTeX place the table here, top, bottom or on its own page, and carries the caption and label.\begin{tabular}{l c r}: the grid itself. Each letter is a column: l left, c center, r right, p{3cm} wrapped text.& separates cells and \\ ends a row.\toprule, \midrule and \bottomrule (booktabs) or \hline draw the horizontal rules.The booktabs documentation (Simon Fear, CTAN) sets out two rules worth following: never use vertical rules, and never use double rules. The default output here follows both.
Have the numbers in a file already? Excel to LaTeX and CSV to LaTeX convert a whole sheet in one go.
For columns of figures, right alignment is usually enough. For true decimal alignment, load the siunitx package and change that column's letter to S.
| You need | Use | Package |
|---|---|---|
| A normal table that fits on the page | tabular inside table | (none; booktabs for nicer rules) |
| Columns with long text that should wrap to the text width | tabularx with X columns | tabularx |
| A table longer than one page | longtable | longtable |
| A wide table rotated 90° | sidewaystable | rotating |
| A table that is just slightly too wide | \resizebox{\linewidth}{!}{…} | graphicx |
| Numbers aligned on the decimal point | S columns | siunitx |
Writing for Typst instead? Use the Typst table generator. Need to get a table out of a .tex file? Use LaTeX to CSV.
booktabs is a LaTeX package that adds \toprule, \midrule and \bottomrule: rules with proper weight and spacing. Most journals and style guides recommend it over \hline and vertical lines. Add \usepackage{booktabs} to your preamble.
The ten special characters & % $ # _ { } ~ ^ \ must be escaped, and & is especially important because it separates columns. The generator converts them to \&, \%, \$, \#, \_, \{, \}, \textasciitilde{}, \textasciicircum{} and \textbackslash{}.
Keep “Wrap in table float” on and set a label such as tab:results. Then write Table~\ref{tab:results} in your text, and LaTeX fills in the number.
tabular never wraps text. Shorten the headers, use p{3cm} columns for long text, reduce the font with \small before the tabular, or wrap it in \resizebox{\linewidth}{!}{…} from the graphicx package as a last resort.
Put a tabular environment inside a table float: \begin{table}[htbp] \centering \begin{tabular}{l c r} … \end{tabular} \caption{…} \end{table}. Separate cells with & and end each row with \\. Or fill in the grid above (or paste from Excel) and copy the generated code.
Yes. This page builds the LaTeX in your browser as you type, with a live preview, and you can paste cells from Excel, Google Sheets, CSV, Markdown or an existing LaTeX table. Tick “Full document” to get a file that compiles on its own in Overleaf or any TeX distribution.
Choose the longtable environment. It replaces table + tabular, repeats the header on each new page (\endhead) and needs \usepackage{longtable}. A table float can never break across pages.
Use tabularx with X columns, which share the remaining width and wrap their text. Alternatively, keep tabular and tick “Scale to \linewidth”, which wraps it in \resizebox from graphicx. That shrinks the font too, so use it for slightly-too-wide tables only.
Horizontally with \multicolumn{3}{c}{Text}, which spans three columns; vertically with \multirow{2}{*}{Text} from the multirow package. Write them in the generated code where you need them; the importer understands \multicolumn when you paste a table back in.
Yes. The output is standard LaTeX. Paste it into your .tex file in Overleaf and add \usepackage{booktabs} if you left booktabs on.