1. Home
    2. Data Converters (JSON/CSV)
    3. CSV to SQL

    CSV to SQL Converter

    Generate ready-to-run CREATE TABLE and INSERT statements from CSV for MySQL, PostgreSQL, SQLite or SQL Server.

    Delimiter
    Database
    INSERT style
    CSV input
    SQL output

    Everything runs in your browser. Your data never leaves your device.

    Quick answer

    How do I convert CSV to SQL?

    Paste your CSV with a header row. The Toolzzz CSV to SQL converter detects whether each column holds whole numbers, decimals, dates or text, writes a matching CREATE TABLE and creates INSERT statements in batches. Quotes are escaped and empty cells become NULL.

    • MySQL, PostgreSQL, SQLite and SQL Server
    • Detects INT, DECIMAL, DATE and text columns
    • Optional CREATE TABLE statement
    • Batched INSERTs: 1, 100 or all rows
    • Escapes single quotes safely
    • Empty cells become NULL
    • Correct identifier quoting for each database
    CSV to SQL Converter: ready-to-run insert queries in your browser
    CSV to SQL on Toolzzz: ready-to-run insert queries, free and private.
    How it works

    How to convert CSV to SQL in 3 steps

    The SQL is rebuilt every time you edit the CSV or an option.

    1. Paste your CSV

      Paste it, including the header row, or press Upload.

    2. Pick the database

      Choose MySQL, PostgreSQL, SQLite or SQL Server, name the table and choose the INSERT style.

    3. Run the SQL

      Press Copy or Download a .sql file and run it in your database client.

    How to convert CSV to SQL in 3 steps in three steps: paste your csv, pick the database, run the sql
    How to convert CSV to SQL in 3 steps in three steps.
    Use cases

    When to use CSV to SQL

    Import spreadsheets

    Load data from Excel or Google Sheets into a database.

    Seed data

    Create seed scripts for development and testing.

    Quick migrations

    Move small tables between systems without import wizards.

    Lookup tables

    Load countries, categories or price lists.

    Review before import

    Read the exact SQL before it touches your data.

    Hosting panels

    Run the script in phpMyAdmin or Adminer when uploads are limited.

    Any device

    How to use the CSV to SQL on Windows, Mac, iPhone and Android

    No app to install. The tool works in any modern browser, so the steps are almost the same everywhere.

    On Windows

    1. Open toolzzz.com/csv-to-sql/ in Chrome, Edge or Firefox.
    2. Paste (Ctrl+V) your CSV into the left box, or press Upload to open a file.
    3. Choose the database and table name.
    4. Press Copy to put the result on your clipboard, or Download SQL to save it. Files go to your Downloads folder.

    On Mac

    1. Open toolzzz.com/csv-to-sql/ in Safari or Chrome.
    2. Paste (Cmd+V) your CSV into the left box, or press Upload to open a file.
    3. Choose the database and table name.
    4. Press Copy to put the result on your clipboard, or Download SQL to save it.

    On iPhone and iPad

    1. Open toolzzz.com/csv-to-sql/ in Safari.
    2. Touch and hold the box, tap Paste to add your CSV into the left box, or tap Upload to open a file.
    3. Choose the database and table name.
    4. Tap Copy to put the result on your clipboard, or Download SQL to save it. Downloads appear in the Files app.

    On Android

    1. Open toolzzz.com/csv-to-sql/ in Chrome.
    2. Long-tap the box and tap Paste to add your CSV into the left box, or press Upload to open a file.
    3. Choose the database and table name.
    4. Tap Copy to put the result on your clipboard, or Download SQL to save it. Downloads go to the Downloads folder.
    Comparison

    Toolzzz vs. other online converters

    FeatureToolzzz CSV to SQLTypical online converters
    PriceFree, no limitsFree tier, then paid plans
    Where your data goesStays in your browserOften uploaded to a server
    Sign-upNot neededSometimes needed to download
    SpeedConverts as you typeUpload, wait, then download
    Size limitOnly your device memoryOften 1 to 10 MB on free plans
    Error messagesLine and column shownOften just "invalid input"

    "Typical" describes common limits of free online services. Plans and limits differ between sites.

    Why Toolzzz

    Why convert data with Toolzzz

    Private by design

    Your data is converted by JavaScript in this tab. Nothing is sent to Toolzzz or anyone else.

    Instant results

    The output updates while you type or paste. There is no queue and no waiting.

    Clear errors

    Invalid input is flagged with the reason and, where possible, the exact line and column.

    Copy or download

    Copy the result in one click or save it as a ready-to-use file.

    Works everywhere

    Windows, Mac, Linux, iPhone, iPad and Android. Any modern browser will do.

    Free forever

    No account, no limits, no watermark and no trial period.

    Pro tips

    Tips for the best result

    • Check the detected types in the status line and adjust the CREATE TABLE if you need a different size or a primary key.
    • Use 100 rows per INSERT for a good balance of speed and query size.
    • For very large files, your database’s bulk loader (LOAD DATA, COPY) is faster.
    • Column names with spaces are quoted correctly for your database.
    • Test on a copy of your database first.
    Glossary

    Key terms explained

    INSERT statement
    SQL that adds rows to a table: INSERT INTO table (columns) VALUES (...).
    Identifier quoting
    Wrapping table and column names in `backticks`, "double quotes" or [brackets] so any name is allowed.
    NULL
    A database value that means "no value", different from an empty string.
    FAQ

    Frequently asked questions

    Is CSV to SQL free?

    Yes. It is free with no limits.

    Is my data uploaded?

    No. The SQL is generated in your browser.

    Which databases are supported?

    MySQL and MariaDB, PostgreSQL, SQLite and Microsoft SQL Server.

    How are column types chosen?

    Each column is checked: all whole numbers become INT, decimals become DECIMAL or NUMERIC, ISO dates become DATETIME, and anything else becomes text.

    How are apostrophes handled?

    Single quotes are doubled, so O'Brien is written as 'O''Brien'.

    What happens to empty cells?

    They are written as NULL.

    Can I skip CREATE TABLE?

    Yes. Untick Include CREATE TABLE to insert into an existing table.

    Can I add a primary key?

    Edit the CREATE TABLE line after copying, for example: id INT PRIMARY KEY.