Boneyard Tools

CSV to SQL INSERT Generator

Paste CSV and turn each row into a SQL INSERT statement. Choose the target table name, whether the first row is a header, and the delimiter. Values are quoted and escaped safely, numbers stay bare, and empty cells become NULL.

How to convert CSV to SQL

  1. Paste your CSV, including the header row if you have one.
  2. Enter the target table name and pick the delimiter and header options.
  3. Copy or download the generated INSERT statements.

Examples

Header row to inserts

name,age
Ada,36
Linus,54
INSERT INTO my_table (name, age) VALUES ('Ada', 36);
INSERT INTO my_table (name, age) VALUES ('Linus', 54);

Custom table with an empty cell

id,email
1,
2,ada@example.com
INSERT INTO users (id, email) VALUES (1, NULL);
INSERT INTO users (id, email) VALUES (2, 'ada@example.com');

Frequently asked questions

How does it decide what to quote?

Each cell is treated as text. Plain numbers like 36 or -3.5 are left bare, empty cells become NULL, and everything else is wrapped in single quotes. Values with leading zeros, such as a zip code 01234, stay quoted strings so they are not turned into a different number.

Are single quotes and special characters handled?

Yes. Single quotes inside a value are doubled, so O'Brien becomes 'O''Brien', which is the standard SQL escaping. Commas inside a quoted CSV field are kept as part of the value rather than splitting the column.

What if my CSV has no header row?

Turn the header option off and the columns are named col1, col2, col3 and so on, one per field. With the header on, the first row supplies the column names instead.

Which SQL dialect does the output use?

It produces plain INSERT INTO table (columns) VALUES (...) statements that run on standard SQL and common databases like PostgreSQL, MySQL, SQLite and SQL Server. Table and column names are sanitized to letters, digits and underscores so the identifiers are safe.

Is my data private?

Yes. Conversion happens entirely in your browser. Nothing you paste is uploaded, logged or stored on a server.

Related tools