Home › Developer Tools › LaTeX Table Generator

LaTeX Table Generator

Type into the grid or paste cells straight from Excel, Google Sheets or a CSV file, and the LaTeX code updates as you go. Merge cells, set column alignment, choose booktabs or bordered styles and add a caption and label, then copy the code into Overleaf or your .tex file.

Last updated:

Table settings

Advertisement
Advertisement

How to use the LaTeX Table Generator

  1. Fill the grid: type in the cells, paste a range copied from a spreadsheet into the top-left cell, or use Import CSV / Excel.
  2. Set column alignment with the menu above each column; choose Wrap p{} for long text and set the width.
  3. Merge cells: drag across cells or Shift+click to select a range and press Merge cells. Select a merged cell and press Split cell to undo.
  4. Choose a style such as booktabs for papers, then add a caption and a label like tab:results for \ref.
  5. Copy LaTeX into your document and add the packages listed under the code, or download a complete .tex file to compile.

Anatomy of a LaTeX table

A LaTeX table has two layers. The tabular environment draws the grid itself; the optional table float around it adds the caption, the label and lets LaTeX move the table to a good spot on the page.

CodeWhat it does
\begin{tabular}{lcr}One letter per column: l left, c center, r right. p{3cm} makes a column of fixed width whose text wraps. A | between letters draws a vertical line.
& and \\& moves to the next cell, \\ ends the row.
\hline, \cline{2-3}A line across the full table, or only across columns 2 to 3.
\toprule \midrule \bottomrulebooktabs rules: thick top and bottom, thin rule under the header, with extra vertical padding.
\cmidrule(lr){2-3}A booktabs partial rule, trimmed on the left and right, often placed under a grouped header.
\multicolumn{2}{c}{Text}One cell spanning 2 columns with its own alignment.
\multirow{2}{*}{Text}One cell spanning 2 rows (multirow package); the row below leaves that cell empty.
\begin{table}[htbp]Float placement preferences: here, top, bottom, separate page. [H] (float package) forces the exact spot.
\caption{...}\label{tab:x}Numbered caption and a key for \ref{tab:x}. The label must come after the caption.

Characters that must be escaped

CharacterMeaning in LaTeXWrite instead
&Column separator\&
%Starts a comment\%
$Math mode\$
#Macro parameter\#
_ and ^Subscript and superscript (math only)\_ and \textasciicircum{}
{ }Grouping\{ \}
~Non-breaking space\textasciitilde{}
\Starts a command\textbackslash{}

Tips for publication-quality tables

  • Skip vertical lines. Most style guides (and the booktabs documentation) recommend horizontal rules only; white space separates columns well enough.
  • Put the caption above the table. Readers scan a table from the top, which is why journals usually place table captions above and figure captions below.
  • Right-align numbers with the same number of decimals so digits line up. For alignment on the decimal point, the siunitx package offers an S column type.
  • Put units in the header, for example “Time (s)”, instead of repeating them in every cell.
  • Group related columns under a merged header and underline it with \cmidrule; this generator adds the rule automatically when you merge cells in a header row.

Frequently asked questions

How do I convert an Excel table to LaTeX?

Select the cells in Excel or Google Sheets and copy them, click the first cell of the grid here and paste. The rows and columns are filled in (the grid grows if needed) and the LaTeX tabular code appears instantly. You can also save the sheet as CSV and open it with Import CSV / Excel.

What is booktabs and why use it?

booktabs is a LaTeX package that adds \toprule, \midrule and \bottomrule: horizontal rules of different weights with better spacing than \hline. It is the standard look in academic papers and journals, which generally discourage vertical lines. Add \usepackage{booktabs} to your preamble.

How are merged cells written in LaTeX?

Cells merged across columns use \multicolumn{n}{c}{text}. Cells merged across rows use \multirow{n}{*}{text} from the multirow package, and the rows below get an empty cell in that position. With bordered styles the generator uses \cline so lines are not drawn through a multirow cell.

Why does my table break when the text contains & or %?

In LaTeX & separates columns, % starts a comment and $ _ ^ # { } ~ \ have special meanings, so they must be escaped (\& \% \$ and so on). Keep Escape special characters switched on for plain text. Switch it off only when your cells contain LaTeX on purpose, such as $\alpha$ or \textit{...}.

My table is too wide for the page. What can I do?

Set long text columns to Wrap p{} with a width like 4cm so the text wraps, pick a smaller font size such as \small, or shorten headers. For very wide tables you can wrap the tabular in \resizebox{\textwidth}{!}{...} from the graphicx package, although scaling makes text smaller than the body.

How do I reference the table in my text?

Give it a label such as tab:results; the generator places \label after \caption, which is required for correct numbering. Then write Table~\ref{tab:results} in your text. Compile twice so LaTeX resolves the reference.

Does it work with Overleaf?

Yes. The output is standard LaTeX that works with pdfLaTeX, XeLaTeX and LuaLaTeX, including Overleaf. Paste the code into the document body and add the listed \usepackage lines to the preamble.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Markdown Table GeneratorBuild Markdown tables in a grid or paste from Excel/CSV, with alignment and preview.HTML Table GeneratorBuild HTML tables in an editable grid with styles, header rows, CSV import and live preview.CSV to Markdown TableConvert CSV to a neatly aligned GitHub Markdown table with column alignment and live preview.CSV ViewerOpen a CSV or TSV file as a sortable, filterable table.LaTeX to PDFCompile LaTeX to PDF in your browser with a TeX engine, live preview, log and PDF download.Online Python CompilerRun Python 3 in your browser with input(), numpy, pandas, charts and share links.JSON EditorEdit JSON in a tree and as code side by side: add, rename, drag, change types, undo and download.Unzip FilesOpen and extract ZIP files online.RAR & 7z ExtractorOpen RAR, 7z and other archives online and extract files.Regex TesterTest and debug regular expressions live.File Info ViewerCheck file size, type, date and MD5/SHA hashes.SQLite ViewerOpen .db and .sqlite files in your browser, browse tables and run SQL queries.DOCX ViewerOpen and read Word .docx files in your browser, then print or save them as HTML.EPUB ReaderOpen and read EPUB e-books in your browser with pages, a table of contents and font controls.What Is My BrowserSee your browser, version, OS, engine, screen and which web features it supports.Font ViewerPreview TTF, OTF, WOFF and WOFF2 fonts with sample text, waterfall, glyphs and metadata.Markdown EditorWrite Markdown with a toolbar, live split preview, autosave and .md or HTML export.Regex Cheat Sheet75+ ready-to-use regex patterns for emails, URLs, IPs and dates, each with a live test box.JavaScript Keycode FinderPress any key to see its JavaScript key, code, keyCode, which, location and modifiers.QR Code ScannerScan QR codes with your camera or from an image and safely read the link or text.RAID CalculatorUsable capacity, efficiency and fault tolerance for RAID 0, 1, 5, 6, 10, 50 and 60 arrays.JSONPath TesterTest JSONPath expressions live: filters, slices, wildcards and recursive search, with matches highlighted.Mermaid Diagram EditorWrite Mermaid code and see flowcharts, sequence, Gantt and ER diagrams live. Export SVG or PNG.Country Codes ListSearch ISO 3166 alpha-2, alpha-3 and numeric country codes with calling codes and TLDs.CSS Selector TesterTest CSS selectors on your HTML: highlighted matches, match count and specificity.Git Cheat SheetSearchable Git command reference by task, with copy buttons and an undo/rename/fix wizard.HAR File ViewerOpen a .har file to see a waterfall timeline, headers, bodies, timings and size totals.jq PlaygroundRun jq filters on JSON in your browser with live output, flags and an example library.Markdown Cheat SheetInteractive Markdown syntax reference: edit every example and see the live rendered preview.Regex ExplainerPaste a regular expression and get a plain-English breakdown, railroad diagram and flag notes.XPath TesterTest XPath expressions on XML or HTML: highlighted matches, node paths, values and examples.EML File ViewerOpen .eml email files to read the message, headers and raw source and save attachments.Graphviz Online ViewerWrite Graphviz DOT code and render graphs live; switch layout engines, export SVG or PNG.JavaScript Online CompilerWrite and run JavaScript in your browser with a console, timing, error lines and share links.Jupyter Notebook ViewerOpen .ipynb files and read code, Markdown, math, tables, plots and errors without Python.Log File ViewerOpen huge log files with level colors, regex and time filters, JSON pretty-print and tail -f.Logic Gate SimulatorBuild logic circuits with AND, OR, NOT, XOR gates and flip-flops; see live outputs and truth tables.MSG File ViewerOpen Outlook .msg emails in your browser: sender, recipients, body, headers and attachments.Sorting Algorithm VisualizerWatch bubble, insertion, merge, quick, heap and radix sort step by step with live counters.Lottie ViewerOpen Lottie JSON or .lottie files to play, pause, scrub frames, change speed and see details.Diff ViewerPaste a git diff or .patch file and view it side by side or inline, with file navigation.EditorConfig GeneratorBuild an .editorconfig with indent, charset, line endings and trim rules per file pattern.Folder Compare ToolCompare two folders by file list, size and SHA-256 hash, then open a text diff of changed files.Glob Pattern TesterTest glob patterns like **/*.js, {a,b} and !exclusions against a list of file paths.JMESPath TesterEvaluate JMESPath expressions against JSON live, the query language used by the AWS CLI.MongoDB Query TesterTest MongoDB find filters, projections and aggregation pipelines on sample JSON documents.Semantic Version CalculatorBump, compare, sort and test SemVer versions against npm ^, ~ and x ranges.XSLT TesterRun an XSLT 1.0 stylesheet on XML in your browser and see the output as HTML, XML or text.ASCII Diagram EditorDraw boxes, arrows and text on a character grid and copy plain-text diagrams for code and READMEs.DBF File ViewerOpen dBase .dbf files and shapefile tables, search and sort records, export CSV or XLSX.MBOX File ViewerOpen .mbox mail archives: list and search messages, read them, save attachments, export EML.MDB File ViewerOpen Access .mdb and .accdb databases in your browser: list tables, view rows, export CSV.Shapefile ViewerView zipped shapefiles on a map with the attribute table, then export to GeoJSON or CSV.Online Code EditorVS Code-style editor in your browser: tabs, 50+ languages, find/replace, autosave.Online Hex EditorOpen any file as hex and ASCII, edit bytes, search, inspect values and save the result.PHP Online CompilerRun PHP 8 code in your browser with output, HTML preview, error lines and share links.PlantUML EditorWrite PlantUML and see sequence, class, activity and more diagrams live. Export SVG or PNG.
See all 53 Code Playgrounds & Testers →