Convert CSV to SQL INSERT statements

Turn a CSV into INSERT statements with correct quoting for your database, an optional CREATE TABLE, and batched rows. Runs entirely in your browser.

CSV to SQL insertsRunning on your device

Source

or drag one here · it stays on your device

Result

Add a CSV file. Pick your database and table name once the preview is up.

How this works
  1. Add your CSV. Drop the file onto the page.
  2. Pick your database. And the table name; CREATE TABLE is optional.
  3. Download. Save the .sql file and run it with your usual client.
What it cannot do
  • Every value inserts as a string; cast to real types in the database, where you can decide what happens when a value does not fit.
  • Inserts are batched five hundred rows per statement — single-row inserts are unusably slow to replay, and a full-file statement can exceed server limits.
  • The result is built in the page, so files past a hundred thousand rows are refused towards CSV import, which every database does better.
Questions
Which databases does it write for?
PostgreSQL, MySQL/MariaDB, SQLite and SQL Server. They differ in identifier quoting, backslash handling and text types, and each file is written for exactly one of them — a “generic” SQL file is one that corrupts on somebody’s server.
How are quotes and special characters handled?
Values are quoted with the doubled-quote rule everywhere; MySQL additionally has its backslashes escaped, and SQL Server literals carry the N prefix so Unicode survives non-Unicode code pages.
What column types does CREATE TABLE use?
The widest text type each database has (TEXT, LONGTEXT, NVARCHAR(MAX)). The tool never knew your columns were numbers, and declaring them as such would undo the care that kept 00412 intact. Cast in the database, where you know the truth.
Why are the rows batched into groups?
Five hundred rows per INSERT replays quickly without exceeding statement-size limits; one row per statement is unusably slow, and one statement for everything can be refused by the server.
Is my file uploaded anywhere?
No. The conversion runs inside this page: when you convert CSV to SQL INSERT statements here, the browser is told to block outbound connections, so nothing can be sent to another server. Keep the Network tab of your developer tools open while you convert CSV to SQL INSERT statements: every request in it goes to this site, and none carries your file.

Your file is processed in this page and never uploaded — the privacy page shows how to confirm that yourself.