SQL to CSV Converter
Paste SQL INSERT statements and get CSV output — pick a delimiter, toggle the header, and paste into your spreadsheet or data tool.
Last updated: May 27, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is SQL to CSV Converter?
A SQL INSERT statement holds the same information as a CSV row, just wrapped in different syntax. Converting between them is mechanical work — but doing it by hand for a dump file with thousands of rows is impractical, and naive find-and-replace breaks on embedded commas and quotes.
This tool parses INSERT statements with a real tokenizer (the same one used for SQL to JSON) and emits a properly quoted CSV. Cells that contain the delimiter, a double quote, or a newline are wrapped in double quotes per RFC 4180, with embedded quotes doubled. The result drops cleanly into Excel, Google Sheets, or any CSV parser.
How to Use SQL to CSV Converter
Paste one or more SQL INSERT statements.
Pick a delimiter: comma, semicolon, pipe, or tab.
Toggle the header row and quote-every-cell options.
Copy the CSV output.
Common Use Cases
- Migrating data from a SQL dump to a spreadsheet for analysis.
- Converting database fixtures into a CSV file for a downstream load.
- Pasting data from a SQL export into Excel or Google Sheets.
- Generating tab-separated output to paste into a TSV-aware tool.
Example Input and Output
A multi-row INSERT becomes a CSV table with a header row.
INSERT INTO users (id, name) VALUES (1, 'Alice'), (2, 'Bob, Jr.');id,name
1,Alice
2,"Bob, Jr."Privacy
All parsing happens in your browser. No SQL is sent to a server.
RFC 4180
The output follows RFC 4180: double quotes wrap fields containing delimiters, quotes, or newlines; embedded double quotes are escaped by doubling them.
Frequently Asked Questions
How is NULL represented in the CSV?
NULL becomes an empty cell. To distinguish empty string from NULL, enable "Quote every cell" — strings will then be wrapped in quotes while NULL stays unquoted-empty.
What is "Quote every cell" for?
Some downstream CSV consumers (PostgreSQL COPY, certain data warehouses) require every value to be quoted. The default is to quote only when necessary.
Does this support SELECT result output?
Only INSERT statements. To export SELECT results, save them as INSERT statements from your client and paste them here.
Does this send my SQL anywhere?
No. All parsing happens locally in your browser.
Related Tools
SQL to JSON Converter
Parse SQL INSERT statements and output the rows as JSON objects. Handles quoted identifiers, escaped strings, NULL, TRUE/FALSE, and multiple rows per statement.
SQL to HTML Converter
Parse SQL INSERT statements and render them as an HTML table — with the table name as a caption, configurable CSS class, and optional inline styles.
SQL to XML Converter
Parse SQL INSERT statements and serialize them as XML — configurable root and row element names, NULL handled as xsi:nil, indented output, and optional XML declaration.
CSV to SQL Converter
Convert CSV data into SQL INSERT statements for MySQL, PostgreSQL, SQLite, or SQL Server with optional CREATE TABLE output.
CSV Viewer
View, search, and sort CSV data as an interactive table. Supports comma, semicolon, tab, and pipe delimiters.
JSON to CSV Converter
Convert a JSON array of objects to CSV. Flattens nested objects with dot-notation columns and handles arrays within values.

