CSV to SQL Insert

Convert CSV data into SQL INSERT statements for MySQL, PostgreSQL, SQLite, and MSSQL — instantly, in your browser.

CSV Input
SQL Output

Options

Tips

• First row must be the column headers

• Values with commas should be quoted

• Empty cells are converted to NULL

• Processing is 100% client-side

About CSV to SQL Insert

This tool converts CSV (Comma-Separated Values) data into SQL INSERT INTO statements, ready to run against your database. It is useful for seeding databases, migrating data, or quickly importing spreadsheets into MySQL, PostgreSQL, SQLite, or Microsoft SQL Server.

All processing happens entirely in your browser — no data is sent to any server, making this tool safe for sensitive data.

How to Use

  1. Paste your CSV into the input area, or click "Load example" to try a sample.
  2. Set the table name to match your database table.
  3. Choose a dialect — MySQL, PostgreSQL, SQLite, or MS SQL Server.
  4. Select the insert type (INSERT INTO, INSERT IGNORE, REPLACE INTO, etc.).
  5. Adjust batch size to control how many rows appear per INSERT statement.
  6. Click "Generate SQL" and copy or download the result.

Dialect Differences

DialectIdentifier QuotingUpsert Support
MySQLBacktick (`col`)INSERT IGNORE, REPLACE INTO
PostgreSQLDouble quote ("col")ON CONFLICT (use INSERT INTO)
SQLiteDouble quote ("col")INSERT OR REPLACE, INSERT OR IGNORE
MS SQL ServerBracket ([col])MERGE (use INSERT INTO)

Frequently Asked Questions

What does "batch size" mean?

Batch size controls how many rows are combined into a single INSERT statement. Larger batches are faster to execute but use more memory. A batch size of 100–500 is common for most databases.

Why are empty CSV values converted to NULL?

An empty cell in CSV typically represents the absence of a value, which maps to NULL in SQL. If you need an empty string instead, update the cells to contain a quoted empty value.

Is my data safe?

Yes. All conversion happens locally in your browser. No data is transmitted to any server.

Does it handle quoted fields with commas?

Yes. The parser correctly handles RFC 4180 CSV format — fields surrounded by double quotes that may contain commas, newlines, or escaped double quotes.