Tools

Home
CSV to JSONCSV ViewerSQL FormatterJSON to CSVTable Generator

CSV to SQL Insert Generator

Convert CSV data to SQL INSERT statements. Specify table name, column types, and get ready-to-run SQL.

Your files never leave your browser
CSV Input0 rows, 0 columns
Drop .csv file here
SQL Output0 statements
Ready·

Paste your CSV, pick a SQL dialect (MySQL, PostgreSQL, SQLite, SQL Server, or Oracle), and get INSERT statements with correct quoting and types in seconds. Column types are auto-detected, and you can switch between individual inserts, batch mode, CREATE TABLE, or upserts without re-entering anything. And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste CSV
➔
Parse & Detect Types
➔
Generate SQL

Drop your CSV in (or paste it), and the parser splits it on commas, tabs, semicolons, or pipes — whichever it detects first. Each column gets scanned to figure out whether the values are integers, floats, dates, booleans, or text. Then the tool maps those types to whatever SQL dialect you picked and builds the INSERT statements. You can override any column type manually if the auto-detection gets it wrong.

Examples

Simple user table for MySQL

You have a short list of users to seed a development database.

INPUT
name,email,age Alice,[email protected],28 Bob,[email protected],34
OUTPUT
INSERT INTO `users` (`name`, `email`, `age`) VALUES ('Alice', '[email protected]', 28); INSERT INTO `users` (`name`, `email`, `age`) VALUES ('Bob', '[email protected]', 34);

Product catalog with CREATE TABLE (PostgreSQL)

An e-commerce team exported a product list and needs a fresh table plus data in one script.

INPUT
sku,product_name,price,in_stock P001,Widget Pro,29.99,true P002,Gadget Mini,14.50,false P003,Bolt Pack,4.99,true
OUTPUT
CREATE TABLE "products" ( "sku" VARCHAR(255), "product_name" VARCHAR(255), "price" DOUBLE PRECISION, "in_stock" BOOLEAN ); INSERT INTO "products" (...) VALUES ('P001', 'Widget Pro', 29.99, TRUE); INSERT INTO "products" (...) VALUES ('P002', 'Gadget Mini', 14.50, FALSE); INSERT INTO "products" (...) VALUES ('P003', 'Bolt Pack', 4.99, TRUE);

Batch insert with NULLs and dates (SQLite)

A data analyst is loading event logs where some fields are missing. Batch mode keeps the file compact.

INPUT
event_id,user,action,timestamp 1,jdoe,login,2024-03-15 2,,logout,2024-03-15 3,msmith,purchase,
OUTPUT
INSERT INTO "events" ("event_id", "user", "action", "timestamp") VALUES (1, 'jdoe', 'login', '2024-03-15'), (2, NULL, 'logout', '2024-03-15'), (3, 'msmith', 'purchase', NULL);

Who Uses This

💻 Backend Developers

Seed local databases with test data from CSV exports without writing INSERT statements by hand.

📊 Data Analysts

Move spreadsheet data into SQL databases for querying, joining, and reporting.

🎓 Students

Generate practice SQL for database coursework from sample CSV datasets.

🚀 DevOps Engineers

Build migration scripts from config exports when provisioning staging or production environments.

Common Mistakes

Forgetting the header row checkbox

If your CSV has headers but the option is unchecked, the tool treats the first row as data. You end up inserting column names as actual values. Double-check that "First row is headers" matches your file.

Wrong delimiter for semicolon-separated files

European CSV exports often use semicolons instead of commas. Auto-detect usually catches it, but if your columns look merged into one big field, switch the delimiter manually.

Using batch INSERT on databases with low query-size limits

Batch mode crams all rows into one statement. Thousands of rows can blow past MySQL's max_allowed_packet or SQL Server's query-size cap. Switch to individual inserts or split the CSV into smaller chunks first.

Technical Details

Frequently Asked Questions

Can I convert a CSV file to SQL without uploading it anywhere?

Yes. This tool processes everything inside your browser using JavaScript. The CSV data never leaves your machine — there's no server involved, no upload, no storage. Refresh the page and it is all gone.

How do I convert CSV to MySQL INSERT statements?

Paste your CSV, pick "MySQL" from the dialect dropdown, and hit Generate. The output uses backtick-quoted identifiers and MySQL-compatible types like INT, DOUBLE, and TINYINT(1) for booleans. Copy the result straight into phpMyAdmin or your MySQL client.

What's the difference between batch and individual INSERT?

Individual mode writes one INSERT per row — easy to read, simple to debug, and safe on any database. Batch mode packs all rows into a single INSERT with multiple value tuples, which runs faster on large imports but can hit query-size limits on some servers.

Does the tool handle quoted CSV fields and special characters?

The parser follows RFC 4180 rules. Fields wrapped in double quotes can contain commas, newlines, and escaped quotes (doubled up). Single quotes inside values get properly escaped in the SQL output based on your chosen dialect.

How large of a CSV can this tool handle?

There is no hard limit — it depends on your browser's memory. Files under 50 MB work fine on most machines. If you have a truly massive dataset, use the "Limit rows" option to process a manageable chunk, or split the CSV beforehand.

Share: