CSV to Markdown Converter
Convert CSV data to clean Markdown tables instantly. Supports custom delimiters, column alignment, drag-and-drop upload, and RFC 4180 parsing.
About
CSV files lack visual structure. Pasting raw comma-separated data into a README or wiki page produces unreadable output. This converter parses CSV input using an RFC 4180-compliant finite state machine and generates GitHub Flavored Markdown (GFM) tables with configurable column alignment. It handles quoted fields containing embedded commas, literal newlines, and escaped double-quotes ("" β "). Delimiter detection is automatic: the parser performs frequency analysis of , \t ; and | across the first 5 lines to determine the separator without user input.
Incorrect CSV-to-table conversion commonly produces misaligned columns, dropped fields, or broken pipe characters. A field containing a literal | will fracture a Markdown table row if left unescaped. This tool escapes pipe characters within cell content and pads columns to produce consistent, human-readable output. The approximation assumes the first row contains headers. If your CSV lacks headers, the tool generates synthetic column labels (Col 1, Col 2, β¦). Maximum tested input: 10 MB or roughly 50,000 rows.
Formulas
The CSV parser operates as a finite state machine with three states. For each character c at position i in the input string of length n, the transition function is:
Column width for padded output is calculated per column j across all m rows:
The separator row for column j with alignment a is built by repeating the dash character - for wj characters, then prepending or appending : based on a β {LEFT, CENTER, RIGHT}.
Auto-detection scores each candidate delimiter d by computing the standard deviation of its occurrence count across sample lines. The delimiter with the lowest non-zero standard deviation wins, as consistent column counts produce uniform frequency.
Where count(d, line) tallies occurrences of d outside quoted regions. The chosen delimiter is argmin(score) among candidates with mean count β₯ 1.
Reference Data
| Delimiter | Symbol | Common Source | Auto-Detected | Notes |
|---|---|---|---|---|
| Comma | , | Excel, Google Sheets export | Yes | RFC 4180 default |
| Tab | \t | TSV files, database dumps | Yes | Common in scientific data |
| Semicolon | ; | European locale Excel | Yes | Used when comma is decimal separator |
| Pipe | | | Log files, custom exports | Yes | Must be escaped in Markdown output |
| Colon | : | /etc/passwd, config files | Manual | Set via custom delimiter option |
| Space | Fixed-width text files | Manual | Ambiguous; use with caution | |
| Markdown Alignment Syntax | ||||
| Left | :--- | Default alignment for text columns | ||
| Center | :---: | Suitable for status codes, short labels | ||
| Right | ---: | Recommended for numeric data columns | ||
| CSV Quoting Rules (RFC 4180) | ||||
| Quoted field | "value" | Required when field contains delimiter, newline, or quotes | ||
| Escaped quote | "" | Two consecutive double-quotes represent one literal quote | ||
| Empty field | ,, | Produces empty cell in Markdown output | ||
| Trailing CRLF | \r\n | Stripped during parsing; does not create extra row | ||
| BOM marker | \uFEFF | UTF-8 BOM stripped automatically from first byte | ||
| GFM Table Limits (GitHub) | ||||
| Max columns | 250 | GitHub renderer limit per table | ||
| Max cell length | 500 chars | Longer content may be truncated in preview | ||
| Nested tables | No | Markdown does not support nested tables | ||