ToolFeather
Developer / SEORuns in your browser

CSV to SQL Converter

Turn a CSV into ready-to-run SQL: a CREATE TABLE with column types inferred from your data, then batched multi-row INSERT statements — written correctly for PostgreSQL, MySQL, SQLite, SQL Server or Oracle.

Quick presets

CSV to SQL Converter

CSV
SQL

Table preview –

Runs in your browser — nothing you enter is uploaded or stored.

ToolFeather · CSV → SQL
Scratchpad auto-saved
Stored in this browser (localStorage)
Step-by-step~40s read

How it works — in four simple steps

No signup and nothing to install — it all runs in your browser.

1

Add your CSV

Paste it into the left box, press Open file, or drag a .csv file onto it. Sample loads a realistic example.

2

Set the options

Adjust the options above the boxes — the output updates instantly as you change them.

3

Check the result

Read the status line: it reports rows, keys and any value that couldn't be represented in SQL.

4

Copy or download

Copy the SQL or download it as a .sql file. Nothing was uploaded at any point.

Pro tip

Pick the dialect first — quoting, booleans and types all change with it.

Features

Delimiter auto-detection

Comma, semicolon, tab or pipe is sniffed from the first lines — European Excel exports with ; just work.

Header row or not

Use the first row as field names, or treat every row as data with generated column1, column2… names.

Real types, not just strings

Numbers, booleans and empty values are detected — while codes with leading zeros such as 00742 or +44 phone numbers stay text.

Five SQL dialects

PostgreSQL, MySQL, SQLite, SQL Server and Oracle — with the right identifier quoting, boolean literals and column types for each.

Batched INSERTs

Rows are grouped into multi-row INSERT statements (capped at 1,000 for SQL Server) so large imports run fast.

CREATE TABLE included

Column types (INTEGER, DOUBLE, BOOLEAN, DATE, VARCHAR(n)…) are inferred from the actual values.

Private by design

Parsing and conversion run in your browser with JavaScript — your data is never uploaded, logged or stored.

About the CSV to SQL Converter

Every database has a bulk loader (COPY in PostgreSQL, LOAD DATA in MySQL, .import in SQLite, BULK INSERT in SQL Server), but they need file access on the server and exact settings. A SQL script is the portable alternative: paste it into any client — psql, MySQL Workbench, DBeaver, SSMS, a migration file or a seed script — and it runs.

The converter parses the CSV (RFC 4180, delimiter auto-detected), types each value, and infers one SQL type per column from all its values: whole numbers become INTEGER (or BIGINT past 2,147,483,647), decimals DOUBLE PRECISION/DOUBLE/FLOAT, true/false BOOLEAN (or TINYINT(1), BIT, NUMBER(1)), ISO dates DATE, ISO date-times TIMESTAMP/DATETIME/DATETIME2, and text VARCHAR(50), VARCHAR(255) or TEXT depending on the longest value. Codes with leading zeros stay text, so ZIP codes and IDs aren't damaged.

Each dialect gets its own syntax: identifier quoting ("…", `…`, […]), boolean literals, N'…' Unicode strings for SQL Server, Oracle's INSERT ALL … SELECT 1 FROM DUAL and DATE '…' literals, and SQL Server's 1,000-row limit per VALUES list. Single quotes inside values are doubled, so names like O'Brien can't break the statement.

Examples

An employee export with an apostrophe in a name, a leading-zero code, a boolean, a date and an empty value.

CSV input
emp_code,name,dept,salary,full_time,hired
00017,Siobhan O'Brien,Engineering,98000,true,2021-04-12
00042,Rahul Deshpande,Design,76500.5,true,2022-09-01
00103,Mei Chen,Support,,false,2025-02-17
SQL output
CREATE TABLE "employees" (
  "emp_code" VARCHAR(50),
  "name" VARCHAR(50),
  "dept" VARCHAR(50),
  "salary" DOUBLE PRECISION,
  "full_time" BOOLEAN,
  "hired" DATE
);

INSERT INTO "employees" ("emp_code", "name", "dept", "salary", "full_time", "hired") VALUES
  ('00017', 'Siobhan O''Brien', 'Engineering', 98000, TRUE, '2021-04-12'),
  ('00042', 'Rahul Deshpande', 'Design', 76500.5, TRUE, '2022-09-01'),
  ('00103', 'Mei Chen', 'Support', NULL, FALSE, '2025-02-17');

This output was produced by the converter on this page with table name employees (PostgreSQL) — load it with the “Employees” preset above and change any option to see the effect.

How CSV maps to SQL

In CSVBecomes in SQL
Header joinedcolumn "joined" (quoted for the dialect)
42, 7INTEGER
98.5DOUBLE PRECISION · DOUBLE · FLOAT · REAL · BINARY_DOUBLE
true / falseBOOLEAN TRUE/FALSE · MySQL TINYINT(1) 1/0 · SQL Server BIT
2026-10-21DATE (SQLite: TEXT)
O'Brien'O''Brien'
Empty cellNULL
Text ≤ 50 / ≤ 255 / longerVARCHAR(50) / VARCHAR(255) / TEXT

Things that trip people up

CSV vs SQL at a glance

PropertyCSVSQL
SpecificationRFC 4180 (2005)ISO/IEC 9075 + vendor dialects
File extension.csv.sql
Media typetext/csvapplication/sql (RFC 6922)
Data typestext only — every cell is a stringper column: INTEGER, DOUBLE, BOOLEAN, DATE, VARCHAR …
CommentsNoYes -- and /* */
NestingNone (flat rows)None (tables)

Frequently asked questions

5 answers
How do I import a CSV into MySQL or PostgreSQL without LOAD DATA or COPY?
Convert it here to a SQL script with CREATE TABLE and INSERT statements, choose your dialect, and run the script in any SQL client.
How are column types chosen?
From every value in the column: all whole numbers → INTEGER/BIGINT, decimals → a floating type, true/false → BOOLEAN (or the dialect's equivalent), ISO dates → DATE, otherwise VARCHAR sized to the longest value.
Why are rows grouped in one INSERT?
Multi-row INSERTs are much faster than one statement per row. Set Rows per INSERT to 1 if your tool needs single-row statements; SQL Server is capped at 1,000 rows per statement.
Is the SQL safe from quote problems?
Yes. Single quotes in values are doubled and identifiers are quoted for the chosen dialect, so apostrophes and odd header names can't break the script.
Is my data uploaded anywhere?
No. The CSV is parsed and converted by JavaScript in your browser tab; nothing is sent to a server, so it is safe for internal exports, customer lists and configuration files with secrets.