CSV to SQL INSERT
Paste a CSV file and get batched INSERT statements ready to run against any SQL database. Choose the table name, single or double-quoted string literals, NULL sentinels and batch size. Handles quoted fields with embedded commas, new lines and quotes, and detects numbers, strings and NULL values automatically.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
From pasted CSV to runnable INSERTs
Paste a CSV table and get INSERT INTO table (columns) VALUES (...), (...); statements batched to the row count you choose. Fields may be quoted with embedded commas, line breaks and doubled quotes, following RFC 4180. Unquoted cells that look numeric become bare numbers and everything else a quoted string literal; the stats count rows, columns and statements.
The migration moment this is for
It suits the times you have a spreadsheet export and a database to seed: a fixtures file for a test suite, a reference table for staging, or a one-off load where wiring up a client library would take longer than the import itself.
Options that change the statement
Table name and the First row is a header switch decide the column list; without a header the columns become col1, col2 and so on. String literal quotes toggles between single quotes for most dialects and double quotes for MS-SQL. The NULL sentinel is matched exactly, Empty cells become NULL handles blanks, and MySQL backslash escapes adds the escaping MySQL expects.
Validation happens before generation
Table and column names must be valid identifiers, duplicate headers are rejected, every data row must hold as many cells as the header, and an unterminated quoted field is reported with its line number. Quote characters inside values are doubled, so a value such as O'Brien cannot break out of its literal.
Your data stays where it is
Parsing and statement generation run entirely in this tab; the CSV is never uploaded and no SQL is executed. You can turn a dump of customer records into INSERTs with no network at all.
Questions
Which databases does this work with?
The output uses standard SQL: INSERT INTO table (columns) VALUES (...), (...); with quoted string literals. It runs on MySQL, PostgreSQL, SQLite, MariaDB, MSSQL (with double-quote literals) and most engines with minor adjustments.
How are strings escaped safely?
Embedded quote characters are doubled (the standard SQL escape, e.g. O'Brien), which prevents accidental breaking of the statement and injection-by-CSV. Line breaks inside quoted fields are preserved as \n escapes.
How does the tool decide numbers vs strings?
A cell that looks like a number and was not quoted in the CSV is emitted as a bare number. Quoted cells, dates and anything else become string literals. Cells equal to the NULL sentinel — or empty when that option is on — become NULL.
What CSV syntax is supported?
RFC 4180: comma-separated, with double-quote quoting for fields containing commas, new lines or quotes, and doubled quotes inside quoted fields. A malformed quote structure raises an error with the position instead of silently mis-splitting rows.
Why batch the INSERTs?
A single giant multi-row INSERT can exceed database statement-size limits. Batching at 100 rows/default keeps each statement well under limits for SQLite and MySQL while staying fast for bulk imports.
Related tools
See categoryCSV to JSON
Parse CSV (RFC 4180) into a JSON array, with delimiter sniffing and type inference.
JSON to CSV
Turn a JSON array of objects into CSV, with delimiter, header, and flatten options.
SQL Formatter (basic)
Pretty-print a SQL query: keyword casing, clause line breaks, indented joins and columns.
CSV Formula Injection Guard
Detect and neutralize spreadsheet formula injection in CSV cells.