Knowledge Mark G
Hire Me

100% free developer tool

CSV to SQL Converter

Turn a CSV file into CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQL Server or SQLite.

  • No sign-up required
  • Instant results
  • Nothing is uploaded
  • Works on any device

CSV input

Delimiter (found: Comma)

4 rows × 9 columns - detected types

idintegernametextemailtextcitytextziptextplantextmonthly_spenddecimalactivebooleansigned_update
1Smith, Janejane@example.comBoston02134Pro49.00true2026-01-05
2Oliver O'Neiloliver@example.co.ukLondon-Starter9.99true2026-02-11
3Lukas Beckerlukas@example.deBerlin10115Team199.00false2026-03-02
4Emma "Em" Rossemma@example.comAustin78701Pro49.00true2026-04-19

SQL

1 KB

Fewer rows per statement = smaller transactions.

customers.sql
CREATE TABLE "customers" (
  "id" INT,
  "name" TEXT,
  "email" TEXT,
  "city" TEXT,
  "zip" TEXT,
  "plan" TEXT,
  "monthly_spend" NUMERIC,
  "active" BOOLEAN,
  "signed_up" DATE
);

INSERT INTO "customers" ("id", "name", "email", "city", "zip", "plan", "monthly_spend", "active", "signed_up") VALUES
  (1, 'Smith, Jane', 'jane@example.com', 'Boston', '02134', 'Pro', 49.00, TRUE, '2026-01-05'),
  (2, 'Oliver O''Neil', 'oliver@example.co.uk', 'London', NULL, 'Starter', 9.99, TRUE, '2026-02-11'),
  (3, 'Lukas Becker', 'lukas@example.de', 'Berlin', '10115', 'Team', 199.00, FALSE, '2026-03-02'),
  (4, 'Emma "Em" Ross', 'emma@example.com', 'Austin', '78701', 'Pro', 49.00, TRUE, '2026-04-19');

Column types detected: id: integer, name: text, email: text, city: text, zip: text, plan: text, monthly_spend: decimal, active: boolean, signed_up: date.

Private by design. Everything happens in your browser. Your files never leave your device.

  • 100% freeNo hidden charges, no watermark
  • Instant resultsDone in seconds, no queue
  • Secure & privateNothing is uploaded
  • Works on all devicesDesktop, tablet and mobile

How to use the CSV to SQL Converter

  1. 1Paste CSV or open a .csv file.
  2. 2Choose your database and table name.
  3. 3Copy or download the .sql file.

From spreadsheet to database in one step

Paste a CSV and get a ready-to-run SQL script: an optional CREATE TABLE with a column type for each field, followed by multi-row INSERT statements. Column types are detected from the data - whole numbers become INT (or BIGINT when they need it), decimals become DECIMAL or NUMERIC, true/false becomes BOOLEAN or BIT, ISO dates become DATE, and everything else becomes text sized to fit.

Written for your database

Each database quotes names and values differently, and the script follows the one you pick. MySQL quotes identifiers with backticks and needs backslashes escaped; PostgreSQL and SQLite use double quotes; SQL Server uses square brackets and N’…’ strings so non-English text survives. Single quotes inside values are doubled for all of them, so a name like O’Brien cannot break the statement.

Batches and limits

Rows are grouped into INSERT statements of 500 by default. SQL Server refuses more than 1,000 rows in a single VALUES list, so the converter caps it there. Smaller batches mean smaller transactions if you are loading into a busy database.

When to use bulk load instead

For hundreds of thousands of rows, the database’s own loader is faster: COPY in PostgreSQL, LOAD DATA INFILE in MySQL, BULK INSERT in SQL Server, .import in SQLite. For anything up to tens of thousands, a script like this is simpler and works through any client. Need JSON instead? Use the CSV to JSON converter.

Frequently asked questions

How do I convert a CSV to SQL INSERT statements?+

Open the CSV, choose your database and a table name, and copy the script: a CREATE TABLE with guessed column types, then INSERT statements with values quoted and escaped for that database.

How do I convert a CSV file to SQL INSERT statements?+

Open or paste the CSV, choose your database and a table name, and the INSERT statements are generated as you type. Download them as a .sql file or copy them into your client.

Which databases are supported?+

MySQL and MariaDB, PostgreSQL, Microsoft SQL Server and SQLite. Each gets its own identifier quoting, string escaping and boolean values.

How are column types chosen?+

From the values in the column: whole numbers, decimals, true/false, ISO dates and date-times are recognised. Anything mixed becomes text. Review the CREATE TABLE before running it - you know your data better than any guess.

What happens to empty cells?+

With 'Empty cells as NULL' on, they become NULL. Off, empty text cells become empty strings, while empty number and date cells still become NULL because '' is not a valid number.

Is it safe with apostrophes and quotes in my data?+

Yes. Single quotes are doubled, which is the SQL standard escape, and MySQL backslashes are escaped too.

Worth reading

All articles →
View all →