Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

LaTeX Table Generator

Edit a table like a spreadsheet and get clean LaTeX code with the packages it needs.

Data No upload Works offline Free, no sign-up

Pasted data replaces the example table. Files: CSV, TSV, HTML, Markdown, LaTeX, JSON or a spreadsheet (.xlsx, .xls, .ods) — read on your device.

Table

Align column A

Column width: empty = as wide as the text; 3cm, 25mm, 1.5in or 30% = wraps at that width; X = shares the free space (tabularx).

Select cells by dragging or with Shift + arrow keys, then press Merge. Type to replace a cell, Enter or double-click to edit, Alt+Enter for a line break. Ctrl+V pastes cells from a spreadsheet, Ctrl+Z undoes.

Edits the selected cell — handy on touch screens. Shift+Enter adds a line break.

LaTeX options

Empty: made from the caption. Refer to it with \ref{…}.

h here, t top, b bottom, p page, ! try harder; H exactly here (adds the float package).

LaTeX code

Preview

An approximation of the typeset table in your browser’s fonts.

Next steps

About the LaTeX Table Generator

Type a table in the grid, or paste a range from Excel, Google Sheets or LibreOffice — merged cells come along — and get LaTeX code that compiles: tabular, tabularx or longtable, with booktabs rules, \multicolumn and \multirow for merged cells, siunitx S columns that line numbers up on the decimal point, fixed or flexible column widths, a caption and a label.

Every special character is escaped for you (& % $ # _ { } ~ ^ \), line breaks inside a cell become \newline or \makecell, and the output lists exactly the \usepackage lines the table needs — nothing more. A preview shows roughly how the table will look.

How to use it

  1. Edit the example, or paste cells copied from a spreadsheet into Paste data to import (or straight into the grid with Ctrl+V). You can also open a CSV, HTML, Markdown or .xlsx file.
  2. Set Header rows (bold, ruled off from the body) and, for totals, Footer rows.
  3. Merge cells: drag across them (or Shift + arrow keys) and press Merge. A heading over two columns becomes \multicolumn, a cell over two rows becomes \multirow.
  4. Click a column and choose its alignment — Decimal (S) aligns numbers on the decimal point with siunitx — and, if it should wrap, a width such as 3cm (or X with tabularx).
  5. Choose the environment, the lines (booktabs is the professional default), caption, label and font size under LaTeX options.
  6. Copy the \usepackage lines into your preamble and the table code where the table goes — or download a complete .tex document to compile on its own.

Examples

A grouped heading over two columns (booktabs)
Input
Model | Accuracy (%) over Train and Test | Time (s)
Baseline | 91.2 | 88.5 | 12.4
Result
\toprule
\multirow{2}{*}{\textbf{Model}} & \multicolumn{2}{c}{\textbf{Accuracy (\%)}} & {\multirow{2}{*}{\textbf{Time (s)}}} \\
\cmidrule(lr){2-3}
 & {\textbf{Train}} & {\textbf{Test}} & \\
\midrule
Baseline & 91.2 & 88.5 & 12.4 \\
\bottomrule

The number columns are siunitx S[table-format=2.1] columns; their headings sit in braces so siunitx treats them as text. \cmidrule(lr){2-3} draws the short rule under the group heading, trimmed at both ends as in the booktabs manual’s examples.

Special characters in cells
Input
R&D costs: 25% of $40k, file_v2 #3
Result
R\&D costs: 25\% of \$40k, file\_v2 \#3
A wrapping column with a fixed width
Input
Column B width: 4cm, alignment: Left
Result
\begin{tabular}{l>{\raggedright\arraybackslash}p{4cm}}

\raggedright avoids the stretched word spacing of justified text in a narrow column; \arraybackslash keeps \\ ending the row. This needs \usepackage{array}, which the output lists.

Common uses

  • Results tables for papers, theses and reports written in LaTeX or Overleaf.
  • Turning a spreadsheet of measurements into a decimal-aligned table without retyping it.
  • Long tables (appendices, data listings) that continue over several pages with the header repeated.
  • Fixing a table that breaks because a cell contains &, %, _ or #.

Packages the code may need

  • booktabs — \toprule, \midrule, \bottomrule and \cmidrule: the rule style of professional tables (no vertical lines, a little space around rules).
  • multirow — \multirow{n}{*}{text} for a cell that spans rows. Spanning columns needs no package: \multicolumn is built into LaTeX.
  • siunitx — S columns align numbers on the decimal point; table-format=3.2 (worked out from your numbers) reserves room for three digits before and two after it.
  • array — >{\raggedright\arraybackslash}p{3cm} for wrapping columns that are not justified.
  • tabularx — X columns share the space left in a table of a given width (for example \linewidth).
  • longtable — tables that break across pages, with the header repeated on each page and “Continued on next page” at the foot.
  • makecell — line breaks inside cells of l, c and r columns.
  • graphicx — only for “Scale to fit the line width” (\resizebox).
  • float — only for the float placement [H] (“exactly here”), which LaTeX itself does not know.

All of them are in TeX Live and MiKTeX (MiKTeX can install a missing package on first use), and Overleaf has them.

Merged cells and rules

A cell merged across columns is written as \multicolumn{n}{c}{…}; across rows as \multirow{n}{*}{…} in its top row with empty cells below; across both as \multicolumn around \multirow, with an empty \multicolumn in the rows below so vertical lines stay right. When a cell spans rows, a full-width rule would cut through it, so the generator draws \cline (or \cmidrule with booktabs) only over the other columns.

Escaping and LaTeX inside cells

Escape special characters (the default) shows exactly what you typed: & → \&, % → \%, $ → \$, # → \#, _ → \_, { } → \{ \}, ~ → \textasciitilde{}, ^ → \textasciicircum{}, \ → \textbackslash{}, and < > | (which the old OT1 font encoding prints wrongly) → \textless{}, \textgreater{}, \textbar{}. Keep $…$ math escapes everything except inline math. Cells are LaTeX writes cells exactly as typed, for commands such as \textit{…} or \cite{…}.

Limitations

  • The preview is an approximation in the browser’s fonts; line breaks, widths and spacing follow LaTeX only roughly. The code itself is what counts.
  • Characters outside Latin scripts (₹, Devanagari, Chinese, emoji) are not in pdfLaTeX’s default fonts: compile with XeLaTeX or LuaLaTeX and a font that has them. The tool notes when this applies.
  • A cell merged across columns uses the alignment letter of its first column (centred for headings); it does not wrap like a fixed-width column.
  • Imported LaTeX tables keep their text but not their merged cells (\multicolumn cells are split); Excel, Google Sheets and HTML keep them.
  • Cell colours, rotated text and footnotes inside the table are not generated.

Privacy

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

Frequently asked questions

How do I convert an Excel table to LaTeX?

Select the cells in Excel (or Google Sheets), copy them and paste into Paste data to import or into the grid. Merged cells are kept. Then copy the code and the \usepackage lines.

How do I merge cells in a LaTeX table?

Across columns: \multicolumn{2}{c}{Text} replaces two cells of a row. Across rows: \multirow{2}{*}{Text} (multirow package) in the top cell, and an empty cell in the row below. In the grid, select the cells and press Merge — the code is written for you.

How do I align numbers on the decimal point?

Choose Decimal (S) for the column. It becomes an siunitx S column with a table-format worked out from your numbers, and headings in that column are wrapped in braces so they are treated as text.

Why does my table not fit the page?

Give long text columns a width (4cm) so they wrap, use tabularx with an X column to fit the line width exactly, choose a smaller font size, or — as a last resort — Scale to fit the line width, which shrinks the whole table, text included.

Should I use booktabs or vertical lines?

The booktabs manual advises against vertical rules and double rules: horizontal rules at the top, below the header and at the bottom read best. Choose All lines (grid) if your journal or teacher wants the boxed look.

Is my data sent anywhere?

No. Editing, importing (also .xlsx files) and generating the code happen in your browser.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.