This CSV converter turns comma-separated data into an HTML table, a Markdown table, SQL INSERT statements, TSV, a plain text table, YAML, vCard contacts or a Word table. Paste your CSV or choose a file, pick the format, and copy or download the result. It handles quoted fields and runs in your browser, so your data is never uploaded.
How to use the CSV converter
- Paste your CSV or choose a file.
- Pick the format to convert to.
- Check the separator and whether the first row holds column names.
- Copy the result or download it.
How the CSV is read
Wikipedia explains that RFC 4180 defines the CSV format and the text/csv media type. A field that contains a comma, a double quote or a line break should be enclosed in double quotes, and a double quote inside a field is written as two double quotes. Each line is a record, and a line terminator is optional on the last line. The data can start with a header record, but there is no way to test whether the first line is a header, so the converter lets you say. The page also notes that the separator is not always a comma, so the converter can find a comma, semicolon, tab or pipe on its own, or you can choose one.
HTML and Markdown tables
The HTML output is a table with a header and a body. Characters that have a meaning in HTML are escaped, so a cell that holds a less-than sign is shown as text, and a line break inside a cell becomes a line break tag. The Markdown output is a pipe table with a separator row under the header. A pipe inside a cell is escaped so it does not split the column.
SQL INSERT statements
Each row becomes an INSERT statement with the column names in the list. Empty cells are written as NULL, plain numbers are not quoted, and text is put in single quotes with any single quote doubled. You can choose standard double-quoted names, MySQL backticks or SQL Server square brackets, and you can add a CREATE TABLE statement. The types in the CREATE TABLE are chosen from the values: whole numbers, decimal numbers or text. Check them before you use them, since the converter can only guess from the data it sees.
TSV and plain text
Wikipedia describes tab-separated values as a plain text format where the values of a record are separated by a tab. It says the IANA media type disallows a tab within a field and a line terminator within a value, so the converter replaces any tab or line break inside a cell with a space. The plain text option lines the columns up with spaces and draws a dashed line under the header, which is handy for an email or a chat message.
YAML
The YAML output is a list of mappings. The page says a list item begins with a hyphen and a space, and that an entry is written as a key, a colon, a space and a value, with indentation made of spaces, not tabs. Plain numbers are written as numbers. Text is written without quotes when it is safe, and in double quotes when it could be read as something else, such as a number, a yes or no word, a date, or text with a colon followed by a space. The page notes that a quoted value such as the string 123 is how YAML tells a string from a number.
vCard contacts
A vCard is a file format for electronic business cards, with the extension .vcf, according to Wikipedia. Every card starts with BEGIN:VCARD and ends with END:VCARD, and the VERSION property is required. The converter writes version 3.0, because the page's property table shows that FN is required from version 3.0 and N is required in version 3.0, so both are written. It finds the columns by their names: Name or Full Name, First Name, Last Name, Phone, Mobile, Email, Company, Job Title, Address, City, State, Zip, Country, Website, Birthday and Notes. Columns with other names are left out. A row with no name, phone or email is skipped.
Word tables
The Word option builds a .docx file with the data as a table with borders and a bold header row. It uses a standard Letter page with one-inch margins, and the columns share the width equally. You can change the column widths in Word afterwards.
Large files and privacy
You can paste text or choose a file of up to 5 MB. The file is read on your device and the result is built there, so nothing is sent to a server. For a very large table, the preview shows only the first ten rows, but the output and the download hold every row.
Common mistakes
- Using the wrong separator. A semicolon file read as comma data comes out as one column.
- Forgetting that the first row is a header. Untick the box if your data has no names.
- Trusting the guessed SQL types. Check them before you run the script.
- Expecting vCard to read unknown columns. Name the columns as listed above.
What next
Use this often? Add CSV to HTML to your Home screen.
Frequently asked questions
What is a CSV converter?
A tool that turns CSV data into another format, such as an HTML table, Markdown, SQL, YAML, vCard or a Word table.
How are quoted fields handled?
A field in double quotes can hold commas and line breaks, and two double quotes inside stand for one, as RFC 4180 describes.
Can it write SQL for MySQL or SQL Server?
Yes. Choose standard double quotes, MySQL backticks or SQL Server square brackets, and optionally add a CREATE TABLE statement.
Which columns does the vCard option use?
Columns named Name, First Name, Last Name, Phone, Email, Company, Job Title, Address, City, State, Zip, Country, Website, Birthday or Notes.
Is my data uploaded?
No. Everything is converted in your browser.
Sources
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.