Developer tool / 25

CSV to SQL INSERT Query Generator

Convert tabular CSV data into SQL INSERT INTO queries with support for PostgreSQL, MySQL, SQLite, and SQL Server.

CSV to SQL INSERT Query Generator: TOEA parses CSV rows, formats string literals, numbers, and NULLs, and wraps them in multi-row SQL INSERT queries. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use

Before you run the statements

The output inserts rows; it does not create the table, so the table and its columns must already exist with names matching the CSV header. Run the file inside a transaction (BEGIN; … COMMIT;) so a failure halfway leaves nothing behind.

Check how values were read. Numbers of up to 15 digits go in unquoted, while codes with leading zeros stay quoted text. A cell containing the word NULL becomes SQL NULL. true and false become TRUE and FALSE for PostgreSQL, MySQL, and SQLite, and 1 and 0 for SQL Server, which has no boolean literals and stores flags in BIT columns. Dates are written as text, so ISO dates like 2024-03-01 are safest.

Large files load faster natively

INSERT statements suit seed data and a few thousand rows. For bigger files, each database has a bulk loader that reads the CSV directly and runs much faster: COPY or \copy in PostgreSQL, LOAD DATA INFILE in MySQL, .import in the sqlite3 shell, and BULK INSERT in SQL Server. To tidy the generated SQL for review, run it through the SQL formatter.

How to use it

  1. Paste or upload your CSV data.
  2. Select table name, SQL dialect, and batching options.
  3. Copy the generated SQL INSERT statements.

Privacy & limitations

CSV data is parsed entirely in local browser RAM without server interaction.

Related tools

Frequently asked questions

Can it handle single quotes in data?

Yes, single quotes inside data cells are automatically escaped for standard SQL.

Free tool · runs in your browser · no account required