---
title: "CSV to SQL"
description: "Paste a CSV and get CREATE TABLE plus INSERT statements for PostgreSQL, MySQL, or SQLite. Column types are inferred, quoted commas survive, and empty cells become NULL. Runs in your browser."
url: https://findutils.com/convert/csv-to-sql/
category: convert
---

# CSV to SQL

Paste a CSV and get CREATE TABLE plus INSERT statements for PostgreSQL, MySQL, or SQLite. Column types are inferred, quoted commas survive, and empty cells become NULL. Runs in your browser.

**Use this tool:** [CSV to SQL](https://findutils.com/convert/csv-to-sql/)

## Programmatic access

- REST id `csv-to-sql`: POST https://api.findutils.com/api/tools/csv-to-sql/execute (reference: https://findutils.com/api/csv-to-sql/)
- MCP tool `csv_to_sql` on https://mcp.findutils.com (reference: https://findutils.com/mcp/csv-to-sql/)

## Why Use Our CSV to SQL Converter?

Loading a spreadsheet into a database usually means either writing the INSERT statements by hand or uploading the file to a site you do not control. Neither is appealing when the CSV holds customer records or unreleased figures. This converter reads the CSV in your browser, infers a type for each column, and writes the SQL you can paste straight into psql, the MySQL client, or the SQLite shell. It never connects to a database and never sends the file anywhere.

## Frequently Asked Questions

### Does my CSV get uploaded anywhere?

No. The CSV is parsed in your browser and the SQL is generated there too. Open your browser developer tools, switch to the Network tab, and convert a file: you will see no request carrying the CSV. That makes the tool safe for exports containing customer records, financial figures, or anything else you cannot share with a third party.

### How are column types decided?

Each column is sampled across the first 50 data rows. A column whose values are all whole numbers becomes an integer type; one that mixes whole numbers and decimals becomes numeric; one containing only true and false becomes boolean; anything else becomes text. Empty cells are ignored during inference, so a column of integers with a few gaps is still an integer column. If a single value does not fit, the column widens to text rather than producing SQL that fails on import.

### What happens to a comma inside a quoted value?

It is preserved. The parser follows RFC 4180: a value wrapped in double quotes may contain commas, and a doubled quote inside such a value means one literal quote. A cell reading "Doe, John" becomes the single SQL literal 'Doe, John' rather than two columns.

### How are empty cells handled?

By default an empty cell becomes NULL, which is almost always what you want in a database. Turn off "Empty cell becomes NULL" to write an empty string instead, which matters when a column is NOT NULL or when an empty string and a missing value mean different things in your schema.

### Which SQL dialects are supported?

PostgreSQL, MySQL, and SQLite. The dialect changes two things: how identifiers are quoted, and which type names appear in the CREATE TABLE. MySQL uses backticks around names; PostgreSQL and SQLite use double quotes. Type names follow each database's conventions, and SQLite stores booleans as 1 and 0 because it has no boolean literal.

### Can I skip the CREATE TABLE?

Yes. Turn off "Include CREATE TABLE" and the output is INSERT statements only, which is what you want when the table already exists and you are just loading rows into it.

### What is the difference between one INSERT per row and a multi-row INSERT?

One statement per row is easier to read and easier to run partially: if one row fails, the others still land. A single multi-row INSERT is considerably faster for large imports because the database plans it once, but it is all-or-nothing inside a transaction. Use per-row for a few dozen rows and the multi-row form for thousands.

### Does it handle a CSV with a semicolon or tab delimiter?

Not yet — the parser reads comma-separated values. If your export uses semicolons or tabs, run it through the CSV to JSON side of the JSON CSV Converter first, or open it in a spreadsheet and re-export with commas.

### What happens to a cell containing JSON?

It is written as a quoted SQL string containing the JSON text, with its internal quotes escaped. It is never rendered as the literal text [object Object], which is a common failure in converters that stringify without checking the value type. If the target column is a JSON or JSONB column, the string literal will cast cleanly on insert.

### Is there a row limit?

There is no server-side limit because there is no server. In practice the limit is your browser's memory. Tens of thousands of rows convert without trouble on a desktop machine; very large files are better handled by your database's own bulk loader, such as COPY in PostgreSQL or LOAD DATA INFILE in MySQL.

## Related Tools

- [JSON to CSV](https://findutils.com/convert/json-to-csv/)
- [CSV to Excel](https://findutils.com/convert/csv-to-excel/)
- [CSV Viewer](https://findutils.com/convert/csv-viewer/)
- [SQL Formatter](https://findutils.com/developers/sql-formatter/)
- [SQLite Browser](https://findutils.com/developers/sqlite-browser/)
- [CSV Merger](https://findutils.com/convert/csv-merger/)
- [CSV Column Extractor](https://findutils.com/convert/csv-column-extractor/)
- [Spreadsheet Editor](https://findutils.com/productivity/spreadsheet-editor/)
- [CSV to NDJSON](https://findutils.com/convert/csv-to-ndjson/)
- [TSV to CSV](https://findutils.com/convert/tsv-to-csv/)
