Underleaf Logo
Underleaf
Blog
Log InTry Free
All tools

Utilities

Utilities

LaTeX Table Generator

Build a LaTeX table visually and copy the code instantly, with a practical guide to tabular, booktabs, and column types

Have a table in an image or screenshot? Use our Table to LaTeX converter to automatically convert table images into LaTeX code.

Import Data:

or paste table data from a spreadsheet.


Common Templates:


Instructions:

1. Create Your Table

Import data, use a template, or start from scratch.

2. Edit Content

Click cells to edit. Use + buttons to add rows/columns.

3. Copy LaTeX Code

Generate and copy the LaTeX code for your document.

Table Editor:

LaTeX Code:

Anatomy of a LaTeX table

A LaTeX table is a tabular environment. The argument after \begin{tabular} is the column spec — one letter per column. Inside, & moves to the next column and \\ ends the row. \hline draws a horizontal rule between rows. That's the entire grammar:

\begin{tabular}{lcr}
  \hline
  Left & Center & Right \\
  \hline
  a    & b      & c     \\
  \hline
\end{tabular}

The generator above writes this for you, with a |c|-style spec that draws every border — handy for drafts and worksheets. For anything going into a paper, read on.

booktabs: how published tables look

Open any journal and count the vertical rules in its tables: zero. Professional tables use three horizontal rules of varying weight and let column alignment do the separating. The booktabs package provides them:

\usepackage{booktabs}

\begin{tabular}{lrr}
  \toprule
  Method   & Accuracy & Time (s) \\
  \midrule
  Baseline & 92.3     & 1.4      \\
  Proposed & 97.1     & 0.9      \\
  \bottomrule
\end{tabular}

\toprule and \bottomrule are slightly heavier than \midrule, and all three add correct vertical padding that \hline doesn't. Drop the vertical bars from the column spec entirely — booktabs is deliberately incompatible with them, and that's a feature.

Column types

l, c, and r size the column to its widest cell and never wrap. The moment a cell holds a sentence, switch that column to p{width}, which wraps text in a fixed-width, top-aligned paragraph. If neighboring single-line cells should sit vertically centered next to it, load the array package and use m{width} instead:

\usepackage{array}

% l/c/r: natural width, no wrapping
% p{4cm}: wraps, top-aligned
% m{4cm}: wraps, vertically centered (array package)
\begin{tabular}{l p{6cm} r}
  Item & A longer description that wraps
         onto several lines & Price \\
\end{tabular}

A useful rule of thumb: numbers right-aligned (r) so digits line up, text left-aligned (l), and c mostly for short header-like content.

Merging cells: multicolumn and multirow

\multicolumn{2}{c}{Header} merges two columns into one cell with its own alignment — the usual way to put a spanning header over a group of columns. Merging vertically needs the multirow package and \multirow{2}{*}{Label}, plus an empty cell in the row below to reserve the space. The details and the common pitfalls are in merged cells in LaTeX.

Tables that span pages

tabular never breaks across pages — a table taller than the text block simply overflows. For long data tables, use the longtable package: same row syntax, but it breaks at page boundaries and can repeat the header on each page:

\usepackage{longtable}

\begin{longtable}{lrr}
  \toprule
  Item & Qty & Cost \\
  \midrule
  \endhead          % repeated at the top of every page
  ... hundreds of rows ...
  \bottomrule
\end{longtable}

Table placement: why your table moved

Wrapping a tabular in \begin{table}[htbp] makes it a float: LaTeX places it where the page breaks work best, which may not be where you wrote it. The letters are preferences in order — here, top, bottom, separate page of floats. Floating is usually the right behavior; captions and \label/\ref numbering depend on it. When a float drifts too far, \usepackage{placeins} and a \FloatBarrier at the end of the section stops tables from crossing it — a gentler fix than the [H] hammer from the float package, which forbids floating entirely and can leave large gaps.

Common table errors

Two errors account for most broken tables. Extra alignment tab has been changed to \cr means a row has more & separators than the column spec has columns — count the cells in the offending row, and remember that a literal & in cell text must be written \&. Misplaced \noalign means a rule command like \hline or \midrule appears mid-row: rules are only legal immediately after a \\, so end the previous row first. If a row renders with cells shifted one column left, the culprit is almost always a forgotten \\ on the line above.

Frequently asked questions

How do I make a table in LaTeX?

Use the tabular environment: \begin{tabular}{lcc} starts a table with one left-aligned and two centered columns, & separates cells, and \\ ends each row. Or skip the syntax entirely: build the table visually above and copy the generated code.

Is this LaTeX table generator free?

Yes. Building tables and copying the code is free with no sign-up. The generator runs in your browser.

Can I import data from CSV or Excel?

Yes. Paste or import CSV data directly into the grid above. For Excel spreadsheets with formatting you want preserved, the Excel to LaTeX converter reads .xlsx files directly.

Should I use booktabs for professional tables?

For papers, yes. The booktabs package replaces \hline with \toprule, \midrule, and \bottomrule, which produce the well-spaced horizontal rules journals expect, and it discourages vertical rules that make tables look cramped.

I already have the table as an image or PDF. Do I need to rebuild it?

No. The Table to LaTeX converter reads a screenshot, photo, or PDF page of an existing table and writes the LaTeX for you, so the visual builder is only needed when you are creating a table from scratch.

More table tools

Have the table as a screenshot or PDF page? The Table to LaTeX converter reads it and writes the code. For the full walkthrough of the tabular environment, see the tables guide.

Explore More Tools

Image to LaTeX

Convert images of notes, equations, or tables to LaTeX code.

Equation to LaTeX

Convert equations to LaTeX code from text or images.

Word to LaTeX

Upload a Word document (.docx) and get clean LaTeX source back.

Table to LaTeX

Convert tables to LaTeX code from text or images.

Free AI tools

Convert anything to LaTeX with AI.

PDFs, images, handwriting, and whiteboard photos — Underleaf turns them into clean, compilable LaTeX in seconds, with AI writing tools included. 10 free credits every month, no credit card required.

Get Started Free
Handwritten notes converted into a typeset LaTeX document
Underleaf Logo
Underleaf

Practical tools for academic writing, document conversion, and research workflows.

Go to appContact us

Company

PricingBlogTutorialsConference TemplatesConference Deadlines

Free Tools

Image to LaTeXExcel to LaTeXArXiv to LaTeXTikZ GeneratorLaTeX Table GeneratorCitation GeneratorThesis GeneratorChrome ExtensionAll Tools

Ask AI about Underleaf

Ask ChatGPTAsk ClaudeAsk Perplexity

© 2026 Underleaf. All rights reserved.