FormatterHQ

LaTeX Table Generator

Paste CSV, spreadsheet cells or JSON and get a complete LaTeX table environment with caption, label and tabular, including booktabs rules and escaped special characters.

Input CSV
Output TEXT
Ready.

How to use the LaTeX Table Generator

  1. Paste CSV, cells copied from Excel or Google Sheets, a JSON array or a Markdown table, or upload a file.
  2. Enter a Caption and a Label (for example tab:results) and pick an Alignment of Left, Center or Right.
  3. Choose Vertical borders for a ruled grid or booktabs style for publication-style rules, and set Bold header and First row is header.
  4. Click Generate LaTeX and paste the result into your .tex document.

LaTeX table generator for papers, theses and reports

Writing a tabular environment by hand is error-prone: an unescaped percent sign comments out the rest of the line, a missing ampersand shifts every column, and a stray underscore stops compilation. This LaTeX table generator takes the numbers you already have in a CSV file or spreadsheet and writes a complete, compilable table float with caption, label and escaped cell contents.

Example

Method,Error (%),Cost ($),Notes
k_means,4.2,120,uses {init}
Baseline #2,7.9,80,~ approx & fast

With the caption Results & costs, the label tab:results and default options:

\begin{table}[htbp]
  \centering
  \caption{Results \& costs}
  \label{tab:results}
  \begin{tabular}{|l|l|l|l|}
    \hline
    \textbf{Method} & \textbf{Error (\%)} & \textbf{Cost (\$)} & \textbf{Notes} \\
    \hline
    k\_means & 4.2 & 120 & uses \{init\} \\
    Baseline \#2 & 7.9 & 80 & \textasciitilde{} approx \& fast \\
    \hline
  \end{tabular}
\end{table}

Every character with a special meaning in LaTeX was escaped, in the caption as well as in the cells.

Special characters that are escaped

In your dataIn the LaTeX output
& % $ # _ { }\& \% \$ \# \_ \{ \}
~\textasciitilde{}
^\textasciicircum{}
backslash\textbackslash{}
line break inside a cella space

Because backslashes are escaped too, you cannot type LaTeX commands such as math into the data and have them pass through. Add math, \multicolumn or colour commands in the .tex file after generating the table.

Options explained

  • Caption and Label – the caption is placed above the tabular, as most style guides expect for tables. The label is cleaned to letters, digits and : . - _, so tab:my results! becomes tab:myresults. Refer to it with \ref{tab:results}.
  • Alignment – l, c or r for every column. Right alignment suits numeric tables; change individual letters in the column spec afterwards if you need a mix.
  • Vertical borders – on by default: a column spec like |l|l| plus \hline above and below the header and at the end. Untick it for a spec such as l l with no rules at all.
  • booktabs style – replaces the grid with \toprule, \midrule and \bottomrule, and turns vertical borders off, as the booktabs package recommends.
  • Bold header – wraps each header cell in \textbf{}.
  • First row is header – untick it for data without column names; no header row or middle rule is written.

booktabs output

Many journals and thesis templates prefer booktabs tables without vertical lines. With booktabs style ticked, centered alignment and no bold header:

% requires \usepackage{booktabs}
\begin{table}[htbp]
  \centering
  \begin{tabular}{c c c c}
    \toprule
    Method & Error (\%) & Cost (\$) & Notes \\
    \midrule
    k\_means & 4.2 & 120 & uses \{init\} \\
    Baseline \#2 & 7.9 & 80 & \textasciitilde{} approx \& fast \\
    \bottomrule
  \end{tabular}
\end{table}

The comment on the first line is a reminder to add \usepackage{booktabs} to your preamble; without it the rule commands are undefined.

How the float is set up

The generator wraps the tabular in a table environment with the placement specifier [htbp], which lets LaTeX put the table here, at the top or bottom of a page, or on a separate float page, whichever fits best. \centering centers it horizontally without adding the extra vertical space that a center environment would. If you need the table exactly at this spot, change the specifier to [h!] or use the float package's [H].

Using a tab: prefix in the label is a common convention that keeps table labels apart from figures (fig:) and sections (sec:) when you reference them.

Tips

  • Numbers are read as numbers, so 4.20 is written as 4.2. If trailing zeros matter, supply the data as JSON with quoted strings, or use the siunitx package to format the column.
  • Wide tables may overflow the text width. Reduce the font with \small inside the table environment or wrap the tabular in \resizebox from the graphicx package.
  • Very long tables that span pages need the longtable package; the generated rows can be reused inside its environment.

The same input can become a Markdown table for a README or an HTML table via Table to HTML. To inspect a CSV before converting, use the CSV viewer.

Privacy

The LaTeX code is produced in your browser, so unpublished results stay on your computer. Only Load URL and Save & Share use our server.

Frequently asked questions

How do I copy a table from Excel into LaTeX?
Select the cells in Excel, copy them and paste into the input. The tab-separated text is detected automatically, and the generator writes the tabular environment with every cell escaped.
Why do I get "Undefined control sequence" for \toprule?
The booktabs style needs the booktabs package. Add \usepackage{booktabs} to your preamble, as the comment at the top of the output reminds you.
Can I use math or LaTeX commands in the cells?
Not directly, because backslashes, dollar signs and braces are escaped so that plain data always compiles. Insert math or commands in your .tex file after generating the table.
Where does the caption go?
The caption is placed above the tabular, which is the usual convention for tables. Move the \caption line below the tabular if your style guide asks for captions underneath.
Can I set a different alignment per column?
The Alignment option applies to all columns. Edit the column spec afterwards, for example change {|l|l|l|} to {|l|r|r|} to right-align the numeric columns.

Last updated September 26, 2026

Related tools

LaTeX Math Renderer Render LaTeX math equations with KaTeX in a live preview and copy the MathML or HTML to use in web pages. Markdown Table Generator Generate GitHub-flavoured Markdown tables from CSV, TSV, Excel cells or JSON, with column alignment and neat padding. Table to HTML Converter Convert CSV, TSV, Markdown or JSON data into a clean HTML table with optional CSS styling and a live preview. Random CSV Generator Generate realistic fake CSV test data — names, emails, addresses, dates and more — with custom fields. Random TSV Generator Generate realistic fake TSV test data — names, emails, addresses, dates and more — with custom fields. Merge CSV Files Merge several CSV files into one: match columns by header name or position, add the source file name, remove duplicate rows. Runs in your browser. CSV Splitter Split a CSV file every N rows, into equal parts or by the values of a column. The header is kept in every file; download parts or one ZIP. Tableizer: Excel to HTML Table Paste cells copied from Excel or Google Sheets and get a styled HTML table. Choose header colour, font and row striping. Compare CSV Files Compare two CSV files by key column or row position: see added, removed and changed rows with old and new values, then export the differences. CSV Editor Online Edit CSV files online like a spreadsheet: change cells, add, move or delete rows and columns, sort, filter, find and replace, undo, then export. CSV to PDF Converter Convert CSV to a printable PDF table: header row on every page, fitted and wrapped columns, A4, Letter or Legal, page numbers. Made in your browser. CSV Viewer View CSV files as a clean, sortable-looking table in your browser. Auto-detects commas, semicolons, pipes and tabs.