CSV to SQL INSERT Converter
Paste CSV, pick a database dialect, and generate CREATE TABLE and INSERT statements right in your browser.
Your data never leaves your browser.
Paste CSV text, choose a file, or select Load example to try the converter.
Inferred schema
Run the output in your database client or import it with your SQL tooling.
How to convert CSV to SQL
-
Paste your CSV
Drop in CSV text, choose a file, or select Load example to try the converter.
-
Choose dialect and options
Pick MySQL, PostgreSQL, SQLite, or SQL Server, name the table, and set header handling, CREATE TABLE, NULL, and batching.
-
Copy or download
Review the inferred schema, then copy the SQL or download it as a .sql file.
The conversion runs locally in your browser. Nothing is uploaded.
Frequently asked questions
Does this upload my CSV data?
No. The conversion runs locally in your browser, and nothing is uploaded or sent to a server.
Which SQL dialects are supported?
You can generate SQL for MySQL, PostgreSQL, SQLite, and SQL Server. Each dialect quotes identifiers its own way, with backticks for MySQL, double quotes for PostgreSQL and SQLite, and square brackets for SQL Server.
How are column types detected?
When you include a CREATE TABLE statement, the tool reads each column and picks a type from the data: whole numbers become INTEGER or BIGINT, decimals become DECIMAL, NUMERIC, or REAL, YYYY-MM-DD values become DATE, true or false become a boolean type, and anything else becomes text. Values with leading zeros stay text so they are not truncated.
How does it handle quotes and empty cells?
Single quotes inside values are escaped by doubling them, so O'Brien becomes O''Brien. Empty cells can be written as NULL, and numbers are only quoted when the column is treated as text.
What is the rows per INSERT setting?
It controls batching. Keep the default to pack many rows into each multi-row INSERT, or set it to 1 to write one INSERT statement per row.
Related tools: all tools, CSV to JSON, JSON to CSV, HTML Table to CSV, CSV to Markdown Table, Remove Duplicates from CSV, JSON Formatter, and Unix Timestamp Converter.
Want tables straight from the page you are viewing, without copying HTML? LightCube Data Extractor is a free Chrome extension that does it in one click.
More guides