SQL INSERT Generator

Turn pasted CSV or JSON rows into bulk INSERT statements — with escaping, batching and MySQL / PostgreSQL dialects.

100% FreeNo sign-upPrivate — runs in your browser

Copied to clipboard

How to use this tool

1
Paste CSV or JSON

CSV with a header row, or a JSON array of objects. Quoted fields with commas are handled.

2
Set table, batch and dialect

Batch size controls rows per INSERT statement (default 100). MySQL, PostgreSQL and SQLite dialects differ in string escaping.

3
Generate

One INSERT per batch, with values escaped and empty cells as NULL.

4
Copy into your database client

Review before running — especially on production.

Formula & worked example

INSERT INTO table (col1, col2) VALUES (v11, v12), (v21, v22); — one statement per batch. Numbers pass through, TRUE/FALSE/NULL are emitted as literals, strings are quoted with dialect escaping (backslash-escaped quotes for MySQL/SQLite, doubled quotes for PostgreSQL).

CSV "id,namen1,Ada" with table users gives: INSERT INTO users (id, name) VALUES (1, 'Ada');

Limitations — read this before you rely on it

Column names must be valid identifiers (letters, digits, underscores). The tool does not validate values against your table's types, constraints or foreign keys, and it cannot detect a CSV whose rows have inconsistent column counts beyond aligning by header position. Always test on a copy first.

Frequently asked questions

Either. CSV is handier from spreadsheets; JSON preserves types (numbers and booleans stay typed instead of being re-inferred from text).

As NULL — an explicit empty string is rarely what a bulk import intends.

A single giant INSERT can exceed packet or statement limits. 100 rows per statement is a safe default; raise it for small rows.

MySQL/SQLite escape them with a backslash; PostgreSQL doubles them — the standard for each dialect.

That tool builds SELECT queries and CREATE TABLE statements. This one turns data rows into INSERT statements.