SQL Output to Markdown Table Converter
Paste query output from mysql, psql or sqlite3 and get a Markdown table; the +---+ borders and row-count footer are stripped.
Sample data shown — paste or drop your own to replace it.
How to convert SQL query output to a Markdown table in 3 steps
Copy the query result
Copy the table printed by mysql, psql or sqlite3 (in table mode), including the header line. The border lines and footers such as “(3 rows)” are removed for you.
Paste it into the box
Paste into the Paste SQL box. It converts as you paste; the first line becomes the header. Open Edit grid to fix cells or set alignment, or use Tools › Auto-align for number columns.
Copy the Markdown
Click Copy Markdown and paste it into an issue, pull request or doc, or download it as .md.
Example
order_id | customer | total | status
----------+-----------+--------+---------
1042 | Ada Lopez | 129.50 | shipped
1043 | Sam Wu | 18.00 | pending
1044 | Noor Aziz | 310.25 | shipped
(3 rows)| order_id | customer | total | status | | -------- | --------- | ------ | ------- | | 1042 | Ada Lopez | 129.50 | shipped | | 1043 | Sam Wu | 18.00 | pending | | 1044 | Noor Aziz | 310.25 | shipped |
Options explained
- Paste SQL box
- Converts 150 ms after you stop typing, and immediately on paste. The badge shows the detected format (“SQL output” for bordered or psql-style tables); the status line shows rows × columns or what went wrong.
- Upload file
- Reads a saved query result from your computer without uploading it anywhere. CSV, TSV, JSON, HTML, Markdown and Excel files are accepted too..txt · .csv · .tsv · .json · .html · .md · .xlsx · .xls · .ods
- Paste / Sample / Clear
- Paste reads the clipboard, Sample loads a MySQL-style result, Clear empties the box.
- Edit grid / Markdown tabs
- Fix cells, rename headers, set alignment or reorder columns after converting, with undo and redo. The Markdown tab shows the source.
- Tools
- Auto-align (numbers right, text left), header case, transpose, and quick or deep clean for stray spaces and blank rows.Auto-align · UPPER · lower · Title Case · Transpose · Quick clean · Deep clean
- Flavor and Spacing
- GFM suits GitHub, GitLab and most editors. Padded lines up the pipes in the source; Compact removes the padding; No outer pipes drops the leading and trailing |.GFM · MultiMarkdown · Pandoc Pipe · reStructuredText · Org-mode · Padded / Compact / No outer pipes
- Collapsible <details>
- Wraps a long result in <details><summary> so it starts collapsed on GitHub.
- Output tabs, Download, Copy link
- Switch the output to HTML, CSV, TSV, JSON, LaTeX, SQL or Jira. Download saves the active format, .xlsx, .csv or .png. Copy link stores the table after #md= in the URL, which browsers do not send to a server.
Convert to and from other formats
Also useful
Convert other formats to Markdown
- CSV to Markdown TableConvert CSV text or .csv files, including quoted cells.
- Excel to Markdown TablePaste cells copied from Excel straight into a Markdown table.
- Google Sheets to Markdown TablePaste a copied range or a public sheet URL.
- TSV to Markdown TableConvert tab-separated text into a Markdown table.
- HTML Table to MarkdownConvert <table> markup into a Markdown table.
- JSON to Markdown TableConvert a JSON array of objects into a table.
- Word Table to MarkdownPaste a table copied from Word or Google Docs.
- Web Table to MarkdownCopy a table from any web page and paste it here.
- Image to Markdown TableTurn a screenshot or photo of a table into Markdown in your browser.
- PDF to Markdown TableExtract a table from a PDF page, with OCR for scans.
- Universal Table to MarkdownPaste anything tabular; the format is detected for you.
Convert Markdown to…
- Markdown Table to CSVExport a Markdown table as RFC 4180 CSV.
- Markdown Table to TSVCopy as tab-separated values that paste cleanly into Excel and Sheets.
- Markdown Table to HTMLExport semantic <table> markup.
- Markdown Table to JSONExport rows as an array of JSON objects.
- Markdown Table to LaTeXExport LaTeX tabular code for papers and Overleaf.
- Markdown Table to SQLGenerate CREATE TABLE and INSERT statements.
- Markdown Table to ExcelDownload a real .xlsx with numbers, bold header and one sheet per table.
- Markdown Table to Google SheetsCopy a table that pastes cleanly into Google Sheets.
- Markdown Table to WordCopy a formatted table into Word or Google Docs, or download .docx.
- Markdown Table to ConfluenceWiki markup, storage format or a rich copy for the Cloud editor.
- Markdown Table to JiraConvert to Jira and Confluence wiki markup.
- Markdown Table to ImageRender the table as a PNG or SVG for slides and posts.
About this tool
Copy the table a database client prints, paste it here, and the Markdown table appears as you paste. The converter keeps the lines with | separators and drops the +----+ borders, the ----+---- rule under a psql header and footers such as “(3 rows)” or “3 rows in set”. It reads mysql and MariaDB bordered output, psql’s default output and SQLite’s table mode. It does not run SQL or connect to a database, and everything stays in your browser.
- Strips +---+ borders from MySQL and SQLite table output
- Reads psql output: header line, ----+---- rule, “(N rows)” footer
- Trims the padding the database added around values
- Also takes tab-separated output (mysql -B) and CSV
- Escapes | in values so columns never shift
- Edit cells and alignment before copying
- Runs in your browser; query results are not uploaded
Technical details
How CLI query output is read
The converter keeps the lines that contain a | and drops everything else: the +----+ border lines, the ----+---- rule psql prints under the header, and footers such as “3 rows in set (0.00 sec)” or “(3 rows)”. The first remaining line is the header and every other line is a row.
- MySQL / MariaDB: The bordered table from the mysql client (+----+------+ above and below the header and at the end) is recognised.
- PostgreSQL: psql’s default aligned output (id | name, then ----+------) is recognised. Numbers right-aligned by psql are trimmed; the Markdown table starts left-aligned.
- SQLite: Use .mode table (a +---+ layout, SQLite 3.33 or later) or the default list mode with .headers on, which prints id|name and is read as a pipe table.
- Not supported: Single-column psql or sqlite3 list-mode results (they contain no |), vertical output (\G or psql’s expanded mode), whitespace-aligned .mode column, and Unicode box-drawing borders such as ┌─┬─┐.
- Values: NULL stays the text NULL, and values are never retyped, so 129.50 stays 129.50.
- Pipes: A | inside a value is ambiguous in the source, because the database prints it as a separator. Output pipes are written as \| in the Markdown table.
- Other formats: CSV, tab-separated, JSON, HTML and Markdown pasted here are detected and converted as well.
Tips and best practices
Run the query with a LIMIT before pasting
A README or issue is easier to read with 5 to 20 rows. Add LIMIT 10 to the query rather than pasting a long result and deleting rows.
Alias columns to readable names
The header comes from the column names in the result. SELECT created_at AS "Created" gives a cleaner header than created_at, and you can also rename headers in Edit grid.
Keep secrets out of the table
Query results often include emails, tokens or IDs. Check the output before it goes into a public issue or README.
Common problems and fixes
Everything ended up in a single column
Cause: The output has no | separators: a one-column psql or sqlite3 list-mode result, SQLite .mode column, or other whitespace-aligned output.
Fix: In SQLite run .mode table first. For psql add a second column, or use \pset format csv and paste the CSV instead.
The table has extra columns or shifted values
Cause: A value in the result contains a | character, which the converter reads as a column boundary.
Fix: Export as CSV instead (mysql -B, psql \copy … csv, or sqlite3 -csv) and paste that, or fix the affected row in Edit grid.
A Unicode box-drawing table does not convert
Cause: Borders drawn with ┌ ─ │ characters are not recognised.
Fix: Switch the client to ASCII table output (for example sqlite3 .mode table, or psql \pset linestyle ascii) and run the query again.
The header row has the wrong labels
Cause: The client printed no header (for example mysql -N or sqlite3 without .headers on), so the first data row was used as the header.
Fix: Re-run the query with headers on, or type the header names into the first line before pasting.
Platform compatibility
| Platform | Support | Notes |
|---|---|---|
| MySQL / MariaDB client | Supported | Bordered table output and tab-separated batch output (-B). |
| PostgreSQL psql | Supported | Default aligned output with the “(N rows)” footer; not expanded (\x) mode. |
| SQLite sqlite3 | Supported | .mode table, or list mode with .headers on. Not .mode column or box. |
| GitHub & GitLab | Supported | The GFM output renders in READMEs, issues, PRs and wikis. |
| CommonMark core | Extension | Tables are not part of core CommonMark 0.31.2; the renderer needs a GFM table extension. |
Frequently asked questions
How do I convert MySQL output to a Markdown table?
Run the query in the mysql client, copy the bordered result (the +----+ table), and paste it into the box above. The borders and the “3 rows in set” footer are removed and the first line becomes the header. Click Copy Markdown to use it.
Does it work with PostgreSQL psql output?
Yes. psql’s default aligned output (a header line, a ----+---- rule, rows, and a “(N rows)” footer) is recognised. Expanded mode (\x) and single-column results, which have no | separators, are not.
How do I get SQLite output into Markdown?
Run .mode table (SQLite 3.33 or later) before the query and paste the +---+ result. The default list mode with .headers on prints id|name lines, which also convert. .mode column and the Unicode .mode box are not recognised.
What if a value contains a | character?
The converter cannot tell it from a column separator, so that row gets extra cells. Export the result as CSV instead (mysql -B, psql \copy … csv, sqlite3 -csv) and paste the CSV, or fix the row in Edit grid. Pipes in the Markdown output are escaped as \|.
Why is the first row of data missing?
The first line is always used as the header. If the client printed no header (mysql -N, or sqlite3 without .headers on), re-run the query with headers on or type the column names above the data.
Can it convert CSV or tab-separated query exports?
Yes. CSV, tab-separated text, JSON, HTML and Markdown are detected automatically when you paste, so a result saved with mysql -B or sqlite3 -csv converts too.
Does it connect to my database or run the query?
No. It only reads text you paste. Parsing runs in your browser, nothing is sent to a server, and a draft is saved in your browser’s local storage so a reload does not lose it.
How do I right-align number columns?
Click Tools › Auto-align to right-align columns that are mostly numbers, or open Edit grid and set alignment from a column’s ▾ menu. The delimiter row then uses ---: for those columns.