CSV to SQL
Convert CSV or TSV into ready-to-run SQL INSERT statements, with an optional CREATE TABLE and inferred column types, for MySQL, PostgreSQL, SQLite or SQL Server — entirely in your browser.
What does this CSV to SQL tool do?
It converts CSV or TSV data into SQL INSERT statements you can run directly in MySQL, PostgreSQL, SQLite or SQL Server. It can also generate a matching CREATE TABLE statement, with column types inferred from your data.
Is my data uploaded anywhere?
No. Parsing and SQL generation happen entirely in your browser with JavaScript, and nothing is ever sent to a server. It even works offline once the page has loaded.
How are quoted fields handled?
The parser follows RFC 4180: fields wrapped in double quotes may contain commas, semicolons, tabs and line breaks, and two consecutive quotes inside a quoted field are read as a literal quote character.
How are column types decided for CREATE TABLE?
Each column is scanned: whole numbers become INT or INTEGER, decimals become DOUBLE or REAL, true/false values become BOOLEAN, and anything else falls back to TEXT. The mapping adapts slightly to the chosen dialect.
What differs between the SQL dialects?
MySQL wraps identifiers in backticks and escapes backslashes in strings; PostgreSQL and SQLite use double-quoted identifiers. TRUE/FALSE literals become 1/0 for SQLite, and CREATE TABLE types also differ slightly. SQL Server wraps identifiers in square brackets, uses no backslash escapes, and outputs booleans as 1/0 with the BIT type.
What does Rows per INSERT control?
It groups rows into multi-row INSERT statements of that size. Fewer, larger statements import far faster than one INSERT per row; 500 is a sensible default for most servers.
How do I run the generated .sql file?
Download it, then run it from a terminal, for example mysql -u user -p dbname < file.sql, psql -d dbname -f file.sql or sqlite3 db.sqlite < file.sql — or simply paste the text into your database client.
My CSV uses semicolons or tabs — will it work?
Yes. Leave the delimiter on auto detect and it is recognized from your first line, or pick semicolon, tab or pipe manually from the Delimiter selector.
How to Use CSV to SQL
This tool converts CSV (or TSV) data into ready-to-run SQL INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server. It can also emit a matching CREATE TABLE with column types inferred from your data. Everything is generated locally in your browser — nothing is uploaded.
- Paste your CSV into the input area, or use Choose file to load a .csv or .tsv from your device.
- Set the table name, pick the SQL dialect (MySQL, PostgreSQL, SQLite or SQL Server) and leave the delimiter on auto detect unless your file uses something unusual.
- Toggle First row is the header to name the columns, and Generate CREATE TABLE if you also want the DDL with inferred INT/FLOAT/BOOLEAN/TEXT types.
- Pick how many rows each INSERT should batch (100, 500 or 1000) — the output updates in real time as you change anything.
- Use Copy to grab the SQL or Download .sql to save it, then run it in your database client or with the mysql, psql or sqlite3 command-line tools.
The parser understands quoted fields, so commas, semicolons and line breaks inside double quotes are safe. Multi-row INSERTs of around 500 rows import much faster than one statement per row. Files over 1 MB are processed in a background worker, so the page never freezes.
Related Tools
- CSV to JSON Converter Convert CSV to JSON online free. Supports custom delimiters, header-based objects, auto type detection. All processing in browser.
- CSV to TSV Converter Convert CSV files to TSV format instantly. Free online tool with custom delimiters, quote handling, and 100% browser-based processing.
- SQL to JSON Convert SQL INSERT statements to JSON arrays or objects instantly. Supports multi-row VALUES, NULL handling, auto type detection, and pretty print. 100% client-side, no upload.
- Chmod Calculator Free online chmod calculator to visualize and calculate Linux file permissions with checkboxes. Instantly convert between numeric (755, 644) and symbolic notation (rwxr-xr-x). Supports special permissions like setuid, setgid, sticky bit.
- ASCII Table Complete ASCII character encoding reference with decimal, hexadecimal, octal, binary codes, HTML entities, and character descriptions. Search and filter instantly.
- HTTP Request Tester Test REST APIs directly in your browser. Send GET, POST, PUT, DELETE requests with custom headers, body, and query parameters. View response status, headers, and JSON body instantly.
- .htaccess Generator Generate Apache .htaccess rules for redirects, rewrites, security headers, caching, compression, and more.
- Robots.txt Generator Free online robots.txt generator. Create and customize robots.txt files to control search engine crawling, manage crawler access, and optimize your site's SEO with an easy visual editor.