DevToolsmith

CSV to SQL Converter

Paste CSV or drop a file to get a CREATE TABLE statement with column types detected from the data, plus INSERT statements ready to run. Choose PostgreSQL, MySQL, SQLite, SQL Server or Oracle, and the quoting, escaping and types follow that database.

Runs 100% in your browser — nothing is uploaded

CSV (first row is the header)
Tip: drop a file here223 chars · 223 bytes · 5 lines
SQL · 2 statements
527 chars · 527 bytes · 15 lines

Limits: 5,000,000 input characters, 50,000 rows, 200 columns, 250,000 cells and 10,000,000 output characters.

ColumnDetectedSQL typeNulls
idintegerINTEGERno
first_nametextTEXTno
emailtextTEXTyes
scoredecimalNUMERIC(4,2)no
activebooleanBOOLEANno
signed_updateDATEno

Type mapping by database

DataPostgreSQLMySQLSQLiteSQL ServerOracle
Whole numbersINTEGER / BIGINTINTEGER / BIGINTINTEGERINTEGER / BIGINTNUMBER(10) / NUMBER(19)
DecimalsNUMERIC(p,s)DECIMAL(p,s)REALDECIMAL(p,s)NUMBER(p,s)
true / falseBOOLEANBOOLEANINTEGER (0/1)BITNUMBER(1)
2026-01-15DATEDATETEXTDATEDATE
2026-01-15 09:30:00TIMESTAMPDATETIMETEXTDATETIME2TIMESTAMP
TextTEXTVARCHAR(n) / TEXTTEXTNVARCHAR(n)VARCHAR2(n CHAR)

Fractional seconds use explicit precision, such as DATETIME(6) for MySQL. When a column exceeds the database’s supported time precision, it stays text to preserve the values. SQL Server text widths count UTF-16 units so supplementary characters such as emoji fit.

Identifiers are quoted only when needed: names with spaces, capitals or reserved words like order and user get "double quotes", `backticks` in MySQL or [brackets] in SQL Server. Turn on snake_case columns to avoid quoting entirely.

Loading big CSV files directly

For files with hundreds of thousands of rows, generate just the CREATE TABLE here, then use the database’s bulk loader, which is far faster than INSERTs:

PostgreSQL (psql)
\copy people FROM 'people.csv' WITH (FORMAT csv, HEADER true)
MySQL
LOAD DATA LOCAL INFILE 'people.csv' INTO TABLE people
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
IGNORE 1 LINES;
SQLite
sqlite3 app.db ".import --csv --skip 1 people.csv people"

Have JSON instead? Use JSON to SQL. To inspect the CSV first, open it in the CSV viewer, and tidy the generated SQL with the SQL formatter.

Frequently asked questions

How are column types detected?

Each column is checked across all rows. Whole numbers become INTEGER (or BIGINT beyond 2,147,483,647), numbers with decimals become DECIMAL with a precision and scale that fit every value, true/false becomes BOOLEAN, valid YYYY-MM-DD dates become DATE and valid ISO date-times become TIMESTAMP. Offsets must be within ±14:00. Invalid dates or offsets make the entire column text, sized to the longest value. Values with leading zeros, like ZIP codes 00501, stay text so the zeros aren’t lost.

How are quotes and special characters escaped?

Single quotes are doubled (O'Brien becomes 'O''Brien'), which works in every database. For MySQL and MariaDB, backslashes are also doubled, because MySQL treats \ as an escape character inside strings by default. For SQL Server, strings with non-ASCII characters get the N prefix (N'café') so they are stored as Unicode.

Is it faster to use one INSERT per row or multi-row INSERTs?

Multi-row INSERTs are much faster: one statement with 500 rows is parsed and committed once instead of 500 times. SQL Server limits a VALUES list to 1,000 rows, so batches are capped there. For Oracle the tool writes one INSERT per row, which works on every version. For very large files, use your database’s bulk loader instead (see below).

What happens to empty cells?

By default they become NULL, and the column is created without NOT NULL. Turn off “Empty cells as NULL” to insert empty strings instead. Columns where every row has a value are marked NOT NULL in the CREATE TABLE.

Is my CSV uploaded?

No. The file is read and converted in your browser, so customer lists and exports never leave your computer. You can download the result as a .sql file.