Converters
CSV to SQL
Generate SQL INSERT statements from CSV. Choose a SQL dialect, quote identifiers and strings, and control NULL and type inference.
Ready to run. Input limit: 1 MB characters.
Output
—
Output actions
Ready to copy output once your result appears.
CSV to SQL mini guide
Generate SQL INSERT statements from CSV. Choose a SQL dialect, quote identifiers and strings, and control NULL and type inference.
How to use CSV to SQL
- 1Paste CSV with a unique header row, or choose Load sample.
- 2Choose Input delimiter, Table name, SQL dialect, type inference and empty-cell NULL behavior.
- 3Select Convert, review the INSERT statement and download it for your own database workflow.
What it is good for
- • Prepare quoted INSERT statements from exports.
- • Select dialect-specific identifier quoting.
- • Choose NULL behavior before a database import.
Example
Input
name,age Alice,30 O'Neil,25
Output
INSERT INTO "records" ("name", "age") VALUES
('Alice', '30'),
('O''Neil', '25');Rules and limitations
Headers become quoted SQL column identifiers. Table name is treated as one literal identifier, including dots; it does not automatically interpret schema.table. PostgreSQL and SQLite use double quotes, while MySQL uses backticks. Embedded identifier quotes are doubled.
All cells become SQL strings by default. Optional inference recognizes safe numbers, booleans and null; PostgreSQL writes TRUE and FALSE, while MySQL and SQLite use 1 and 0. Empty cells become NULL only when the corresponding option is checked.
String apostrophes are doubled. PostgreSQL values containing backslashes use escape string literals; MySQL output assumes its default backslash escape mode. Review your server SQL mode and column types before executing the generated statement. This utility produces INSERT only; it does not create or alter a database.
Common problems
Row widths must match unique, non-empty headers. Malformed CSV quoting stops conversion to prevent silently dropping fields.
Spreadsheet formulas remain literal strings in SQL. The utility does not connect to a database or execute statements; run a small batch in your own transaction and verify the inserted rows.
Frequently asked questions
Which SQL dialects are supported?
PostgreSQL, MySQL and SQLite identifier and value conventions are available.
Can empty cells become NULL?
Yes. Enable Empty cells become NULL; otherwise they are empty strings.
Does it create a table?
No. The table and compatible columns must already exist.
Are numeric-looking identifiers preserved?
Yes by default. Type inference is optional, and leading-zero values stay strings.
Is my input uploaded or saved?
This tool processes input in your browser and does not save its input or output to local storage. Copy and download are user actions. The site uses analytics for page and action metadata and may use ads and production error reporting; see the Privacy Policy for those services.
About this tool
Maintained by Toolbench. For large or deeply nested files, split the input into smaller batches and verify representative results before using them in an import or application. Report reproducible problems through Contact.
Continue with a practical guide
Prepare CSV for PostgreSQL, MySQL or SQLite INSERTValidate records, preserve identifiers, choose NULL behavior and inspect generated SQL before importing.
Related tools
Continue the workflow with nearby tools for formatting, publishing, debugging, or follow-up checks.
CSV to JSON
Convert CSV data to a JSON array of objects.
CSV Delimiter Converter
Convert semicolon CSV to comma, tab or pipe separators while preserving quoted delimiters, escaped quotes and multiline cells.
JSON to CSV
Convert a JSON array of objects to CSV.
HTML Table to CSV
Convert an HTML table to CSV. Select a table, choose delimiters and control rowspan and colspan with repeated or blank covered cells.