CSV to SQL Converter - Import CSV Data Into Any Database
Every database import starts as a CSV and a pile of hand-written INSERTs. Paste the CSV, pick MySQL, PostgreSQL or SQLite, and get import-ready SQL in one click.
How to use the CSV to SQL Converter
- Paste your CSV - the first row must be the column names.
- Type a table name and choose your SQL dialect.
- Leave CREATE TABLE ticked if you want the table definition too.
- Click Generate SQL, then copy it or download the .sql file.
- Run the SQL in your database client to import the data.
How it works
Column types are inferred by scanning every value in the column: whole numbers become integers, decimals become floating point, true/false become booleans, and ISO dates (YYYY-MM-DD, with an optional time) become date/timestamp columns. A column that mixes types falls back to the widest type, and a column of mixed numbers and text becomes TEXT so nothing is lost. Empty cells become NULL. Identifiers are sanitised - lowercased, spaces and punctuation replaced with underscores, a leading digit prefixed - and then quoted for the dialect: backticks for MySQL, double quotes for PostgreSQL and SQLite. String values are single-quoted with internal quotes doubled, the SQL-standard escape.
Worked example
The row Ali,30,true under name,age,active becomes INSERT INTO "my_table" ("name", "age", "active") VALUES ('Ali', 30, TRUE); in PostgreSQL dialect.
Frequently Asked Questions
Is this CSV to SQL converter free?
Yes - completely free, no sign-up, no cap.
How are column types chosen?
By scanning all values in each column. Integers, decimals, booleans and ISO dates are detected; mixed columns fall back to TEXT.
What happens to empty cells?
They become NULL in the INSERT statements.
Which dialects are supported?
MySQL (backtick quoting), PostgreSQL and SQLite (double-quote quoting), with dialect-appropriate type names.
Is my data uploaded?
No. Conversion happens entirely in your browser.
Related Developer Tools
CSV to JSON Converter
Convert CSV to a JSON array of objects - a real parser that handles quoted commas and escaped quotes.
JSON to CSV Converter
Turn a JSON array of objects into a clean CSV file - union of all keys, proper quoting, one click.
CSV Viewer & Editor
Load CSV into an editable table grid - edit cells, sort columns, add rows and download the result.