CSV to SQL Converter
Convert CSV into ready-to-run CREATE TABLE and INSERT statements. The parser handles quoted fields with embedded commas and newlines, auto-detects the delimiter, and infers a SQL type for each column (with a per-column override). Pick PostgreSQL, MySQL, SQLite, or SQL Server and the identifiers, column types, and boolean literals adapt to your dialect. Live output updates as you type - copy, download, or share a link.
About this ToolHow it works, benefits & use casesTap to collapse
Turn a block of CSV into a ready-to-run table and the INSERT statements to populate it, with output that adapts to your database. Paste your CSV and the converter auto-detects the delimiter (or you can pick comma, semicolon, tab, or pipe), reads the header row, sanitizes each name into a safe column identifier, and infers a SQL type per column: integer for whole numbers, decimal for fractional numbers, boolean for true/false/yes/no values, date for recognizable date formats, and VARCHAR (sized to the longest value) or TEXT for longer strings. Every inferred type can be overridden per column from the preview table, and empty cells become NULL. Choose PostgreSQL, MySQL, SQLite, or SQL Server and the identifier quoting, column types, and boolean literals all change to match - double quotes and TRUE/FALSE for Postgres, backticks and TINYINT(1) for MySQL, brackets and BIT for SQL Server. Toggle the CREATE TABLE header and the INSERT statements independently, switch between one multi-row INSERT and one statement per row, and set the batch size. The parser is RFC-4180 friendly: quoted fields keep embedded commas and newlines, and doubled quotes are treated as escapes. Output updates live as you type, with one-click examples for users, products, orders, and employees, and a fully shareable URL. Everything runs in your browser.
How to Use
- 1Click an example CSV (Users, Products, Orders, or Employees) or paste your own CSV with a header row.
- 2Set the table name and pick a SQL dialect: PostgreSQL, MySQL, SQLite, or SQL Server.
- 3Choose a delimiter (or leave it on auto-detect) and confirm whether the first row is a header.
- 4Review the detected columns and override any inferred type from the preview table.
- 5Toggle CREATE TABLE, INSERT statements, and multi-row batching, then copy, download, or share the SQL.
Key Benefits
- Infers integer, decimal, boolean, date, or VARCHAR/TEXT per column, with a per-column override
- Dialect-aware output for PostgreSQL, MySQL, SQLite, and SQL Server
- Robust CSV parsing: quoted fields with embedded commas and newlines, escaped quotes, auto-detected delimiter
- Empty cells become NULL and single quotes are escaped automatically
- Independent CREATE TABLE and INSERT toggles, plus multi-row batching with a configurable batch size
- Live output, built-in example datasets, and a fully shareable URL
- Runs entirely in your browser - no CSV ever leaves your machine
Common Use Cases
- Importing a spreadsheet export into a database without writing schema by hand
- Bootstrapping a table from a CSV during early prototyping
- Generating seed data INSERTs from a sample dataset
- Inspecting how columns would be typed before designing a real schema
- Converting a CSV report into INSERT statements for a test database
| Column | SQL type | Override |
|---|---|---|
| first_name | VARCHAR(50) | |
| last_name | VARCHAR(50) | |
| VARCHAR(50) | ||
| age | INT | |
| city | VARCHAR(50) |
Copy, download, share, or pipe to another tool
CREATE TABLE "users" (
"first_name" VARCHAR(50) NOT NULL,
"last_name" VARCHAR(50) NOT NULL,
"email" VARCHAR(50) NOT NULL,
"age" INT NOT NULL,
"city" VARCHAR(50) NOT NULL
);
INSERT INTO "users" ("first_name", "last_name", "email", "age", "city") VALUES
('John', 'Doe', '[email protected]', 30, 'New York'),
('Jane', 'Smith', '[email protected]', 25, 'Los Angeles'),
('Michael', 'Johnson', '[email protected]', 35, 'Chicago');
Target
Options
175 characters · paste CSV or load an example
Robust parsing
The parser is RFC-4180 friendly: quoted fields keep embedded commas and newlines, "" is treated as an escaped quote, and the delimiter is auto-detected (or pick comma, semicolon, tab, or pipe yourself).
Dialect-aware output
Types and quoting follow your dialect: PostgreSQL gets double quotes and TRUE/FALSE, MySQL gets backticks and TINYINT(1), SQL Server gets brackets and BIT. Empty cells become NULL, and you can override any inferred column type from the preview table.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related tools
- SQL FormatterFormat and beautify SQL queries
- JSON to CSVConvert JSON to CSV format
- Color ConverterConvert between HEX, RGB, HSL, and HSV
- cURL to Code ConverterConvert cURL commands to code in various languages
- HTML to MarkdownConvert HTML to Markdown
- npm to Yarn ConverterConvert npm commands and package-lock.json to Yarn equivalents
The converter examines every non-empty value in a column. If all are whole numbers it picks integer, fractional numbers give decimal, true/false/yes/no values give boolean, recognizable dates (YYYY-MM-DD, MM/DD/YYYY, or DD-MM-YYYY) give date, and otherwise it uses VARCHAR sized to the longest value (50 to 255 characters) or TEXT when values exceed 255. You can override any inferred type per column from the preview table.
Only the SQL syntax changes; the data is the same. PostgreSQL uses double-quoted identifiers and TRUE/FALSE booleans. MySQL uses backtick identifiers and TINYINT(1) with 1/0 booleans. SQL Server uses bracketed identifiers, NVARCHAR, and BIT. SQLite uses INTEGER and REAL with loose typing. The right column types and boolean literals are emitted for whichever dialect you pick, so the script loads without edits.

