The quick answer

Paste CSV, set the table name (the Table field defaults to my_table), and each data row becomes one INSERT statement as you type. The built-in sample, name,age with Alice,30 and Bob,25, yields exactly 2 lines starting INSERT INTO my_table (name, age) VALUES ('Alice', 30);. Numbers stay unquoted, true/false become TRUE/FALSE, empty cells become NULL, single quotes double. The tool writes text and never touches a database.

What the CSV to SQL Insert is

The CSV to SQL Insert is a browser utility that turns CSV rows into INSERT statements. The whole computation runs as JavaScript on your machine: paste into the input panel and the output panel fills live, one statement per row, with no calculate button and no page reload. A Table field under the input holds the name the statements will use, defaulting to my_table. Nothing uploads, and no database is contacted at any point.

The regulars are backend developers seeding test databases, QA engineers turning CSV fixtures into reproducible INSERTs, and DBAs preparing reviewed one-off imports. The output is plain text you read before you run, and that review step is the reason this tool generates statements instead of executing them.

Load example fills the input with the site's own 3-line sample, Clear empties it, and Copy and Download (as csvToSql.txt) take the output wherever it needs to go. The tool belongs to the json, csv and data tools collection, and it pairs with the CSV to JSON Converter when a pipeline needs typed records instead of SQL.

How the generator builds each statement

Stage one is the CSV parse: a character-by-character RFC 4180 state machine that walks quoted fields, doubled quotes and embedded newlines, so a cell like "Smith, John" stays one value. The header row becomes the column list, normalized the way SQL schemas like it: trimmed, lowercased, with internal whitespace turned into underscores. "First Name" becomes first_name.

Stage two types each value by rule, and the rules are short. An empty cell becomes the unquoted NULL keyword. A plain number, integer or decimal with an optional minus, stays unquoted: 30 stays 30. true and false in either case become TRUE and FALSE. Everything else is single-quoted, with internal single quotes doubled: O'Brien lands as 'O''Brien'. Each row then becomes one line, INSERT INTO your_table (columns) VALUES (values);, and the output opens with a comment line counting the statements: -- 2 INSERT statements for table "my_table".

The typing boundary is literal: cells matching a plain integer or decimal pattern pass through as written, and everything else is quoted. Dates like 2026-11-08 contain hyphens, so they are quoted strings. Scientific notation like 1e5 is quoted too. And the cell text is never re-parsed into a JavaScript number, so a 20-digit identifier keeps every character it had in the spreadsheet.

A worked conversion you can check by hand

The built-in sample, end to end

Input

name,age
Alice,30
Bob,25

Output

-- 2 INSERT statements for table "my_table"
INSERT INTO my_table (name, age) VALUES ('Alice', 30);
INSERT INTO my_table (name, age) VALUES ('Bob', 25);

Note under the panel: 2 rows

Every rule is visible in those two lines: Alice is quoted as a string, 30 and 25 stay unquoted numbers, and the comment line states the count for the table you named. The note under the panel reads 2 rows, the same count a second way. Now the edges that break hand-written SQL. A cell holding O'Brien produces 'O''Brien', standard doubling rather than a typo. An empty age cell produces NULL, the keyword, not the string 'NULL'. A true in either case produces TRUE. And a paste with only a header row produces no statements at all: the output says it needs a header plus at least one data row, so a missing file never masquerades as a clean conversion.

Accuracy and limits

The documented boundaries, each verified against the generator as shipped:

  • Comma is the only input delimiter, and this page has no delimiter control. Semicolon- or tab-separated exports convert as one fat column, so convert the delimiters to commas before pasting.
  • Leading-zero codes: 02134 matches the numeric pattern and is emitted unquoted, and several dialects read that as 2134. Quote such values in the output by hand when the zero matters.
  • Ragged rows: a data row shorter than the header fills the missing cells with NULL, and extra trailing cells are dropped without a warning. Check wide-but-short rows in the source first.
  • Header normalization is trim, lowercase and underscores: "Age (years)" becomes age_(years), parentheses intact. Rename exotic headers in the source if the schema rejects them.

Your data never leaves the tab

Parsing and statement generation are pure functions running in the tab. The files people bring to a CSV-to-SQL conversion are customer exports, credential lists and config tables, exactly the category that should not cross a network boundary, and here nothing does. This tool loads no processing library even on demand: the whole conversion is plain JavaScript already in the page, so the network panel stays empty from paste to copy.

The local design has a practical consequence: the page works offline once loaded. Generating INSERT statements is arithmetic over text, and there is nothing to phone home for.

Comparing routes

AlternativeWhy people pick the CSV to SQL Insert instead
Server-side convertersIdentical statements without uploading customer data or credentials to a third party, and no file-size quota
Writing INSERTs by handA 40-row spreadsheet is 40 statements to transcribe; one paste types them with zero transposition errors
Import wizards (LOAD DATA, BULK INSERT)No CLI access or admin permissions needed, and the output is reviewable text that pastes into a change ticket

The ledger has both columns. Import wizards move data directly and handle very large files better, and the command line still wins for scripted pipelines. For the quick, private, reviewed one-off, paste beats both.

Frequently asked questions

Is the CSV to SQL Insert free to use?

Yes. The cost is zero: no account, no email address, no limit on sessions. CSV to SQL Insert runs entirely in your browser, so each extra use costs this site nothing and costs you nothing either. Bookmark it and return whenever the task reappears.

Does the tool connect to my database?

No, never. It generates SQL text and stops there: no connection string, no driver, no execution. The statements are yours to review and run yourself, which is the correct order of operations for anything that mutates a table.

Are the files I convert uploaded anywhere?

No. Parsing and statement generation are browser-side JavaScript with zero transmission to any server. The page works offline after loading, so even a sensitive customer export never crosses a network boundary.

Can I use the CSV to SQL Insert offline?

Yes. The core functionality is local, so cached pages work offline. Generating INSERT statements is pure computation; there is nothing to phone home for.

How are column names derived from my header?

Each header cell is trimmed, lowercased, and has internal whitespace replaced with underscores: "First Name" becomes first_name. That matches the naming convention most schemas expect, and it happens identically in every statement.

Why did "42" come out as a number?

Deliberate typing: a cell matching a plain numeric pattern stays unquoted, so 42 lands as the SQL literal 42. Values that do not match the pattern are quoted as strings, and the boundary is documented in the methodology above.

What happens to empty cells?

They become the unquoted NULL keyword, not the string 'NULL'. That is usually what a table wants for missing data, and it is visible in every generated statement so you can audit it before running.

How are single quotes escaped?

By doubling, per the SQL standard: O'Brien becomes 'O''Brien'. The doubled quote is what keeps the statement valid when the value itself contains a quote character.

Which databases do the statements work in?

The output is plain INSERT INTO table (columns) VALUES (...); syntax, standard enough for MySQL, PostgreSQL, SQLite and SQL Server. Nothing dialect-specific is emitted, so the same statements paste into any of them.

What if my file has no header row?

The tool needs a header plus at least one data row, because the header supplies the column names. A header-only or empty paste produces an explanatory message instead of statements, so an empty result never masquerades as success.

Sources and further reading

The quoting rules the generator follows are SQL-standard: single quotes delimited by doubling, NULL as an unquoted keyword, TRUE and FALSE as boolean literals. RFC 4180 governs the CSV at the front door. The list also carries the JSON, YAML and XML specifications used by the sibling converter pages in the same collection, so one bookmark covers the family.

The method above is the whole contract: paste, review the statements, run them where you will. Bookmark the page if the job recurs; it converts the same way every time.

Sources and further reading

We cite primary sources (standards bodies, government agencies, official documentation) wherever they exist so you can verify every number on this page yourself.