Skip to content

File & Data Tools

Convert CSV to SQL

Generate INSERT statements, optionally preceded by a CREATE TABLE with inferred column types.

  • Free, no signup
  • No upload — runs on your device
  • No watermark
  • Unlimited use

CSV to SQL

Processed locally
Drop a CSV file here

The header row becomes the column names

The generated schema is a first draft, not a schema

Column types here are inferred from a 500-row sample. If every sampled value in a column is an integer, the column becomes INTEGER — and then row 12,000 contains N/A and your import fails. Sampling is a heuristic, and heuristics are wrong at the tails, which is exactly where dirty data lives.

Two specific traps. A column of values like 01234 looks numeric and will be typed INTEGER, destroying the leading zero on import — the same failure as Excel, arriving by a different route. And a column that is 499 integers and one empty string will be typed INTEGER, then reject the empty row rather than treating it as NULL.

Read the CREATE TABLE before you run it. Widen anything that might exceed the inferred type, change identifier-like numeric columns to TEXT, and add your own primary key — the generator does not invent one, because guessing which column is unique is a much worse error than omitting the constraint.

How it works

  1. Drop in a CSV
  2. Set the table name and pick a SQL dialect
  3. Review the generated types, then download the .sql file
Why nothing uploads. Every operation on this page happens inside your browser using JavaScript and WebAssembly. Your file is read into memory, processed, and offered back as a download. It is never transmitted. Disconnect from the internet after this page loads and the tool keeps working.

Frequently asked questions

Are the inferred column types reliable?
They are inferred from the first 500 rows, so they are a reasonable first draft and nothing more. Widen types before running the DDL, and change identifier-like numeric columns to TEXT.
Why is there no primary key in the CREATE TABLE?
Because the tool cannot know which column is unique. Guessing wrong produces a constraint violation on import; omitting it lets you add the correct one yourself.
How are quotes in my data handled?
Single quotes are doubled, which is the SQL standard escape. Values are wrapped in single quotes unless they look purely numeric.
What is the difference between the dialects?
Identifier quoting. MySQL uses backticks, PostgreSQL and SQLite use double quotes. The numeric type names also differ slightly.
Is there a row limit?
The preview shows the first 1,000 statements to stay responsive. The downloaded file contains every row.