consolelog.tools

CSV to SQL Converter

Convert CSV into ready-to-run CREATE TABLE and INSERT statements. The parser handles quoted fields with embedded commas and newlines, auto-detects the delimiter, and infers a SQL type for each column (with a per-column override). Pick PostgreSQL, MySQL, SQLite, or SQL Server and the identifiers, column types, and boolean literals adapt to your dialect. Live output updates as you type - copy, download, or share a link.

About this ToolHow it works, benefits & use cases

Turn a block of CSV into a ready-to-run table and the INSERT statements to populate it, with output that adapts to your database. Paste your CSV and the converter auto-detects the delimiter (or you can pick comma, semicolon, tab, or pipe), reads the header row, sanitizes each name into a safe column identifier, and infers a SQL type per column: integer for whole numbers, decimal for fractional numbers, boolean for true/false/yes/no values, date for recognizable date formats, and VARCHAR (sized to the longest value) or TEXT for longer strings. Every inferred type can be overridden per column from the preview table, and empty cells become NULL. Choose PostgreSQL, MySQL, SQLite, or SQL Server and the identifier quoting, column types, and boolean literals all change to match - double quotes and TRUE/FALSE for Postgres, backticks and TINYINT(1) for MySQL, brackets and BIT for SQL Server. Toggle the CREATE TABLE header and the INSERT statements independently, switch between one multi-row INSERT and one statement per row, and set the batch size. The parser is RFC-4180 friendly: quoted fields keep embedded commas and newlines, and doubled quotes are treated as escapes. Output updates live as you type, with one-click examples for users, products, orders, and employees, and a fully shareable URL. Everything runs in your browser.

How to Use

  1. 1Click an example CSV (Users, Products, Orders, or Employees) or paste your own CSV with a header row.
  2. 2Set the table name and pick a SQL dialect: PostgreSQL, MySQL, SQLite, or SQL Server.
  3. 3Choose a delimiter (or leave it on auto-detect) and confirm whether the first row is a header.
  4. 4Review the detected columns and override any inferred type from the preview table.
  5. 5Toggle CREATE TABLE, INSERT statements, and multi-row batching, then copy, download, or share the SQL.

Key Benefits

  • Infers integer, decimal, boolean, date, or VARCHAR/TEXT per column, with a per-column override
  • Dialect-aware output for PostgreSQL, MySQL, SQLite, and SQL Server
  • Robust CSV parsing: quoted fields with embedded commas and newlines, escaped quotes, auto-detected delimiter
  • Empty cells become NULL and single quotes are escaped automatically
  • Independent CREATE TABLE and INSERT toggles, plus multi-row batching with a configurable batch size
  • Live output, built-in example datasets, and a fully shareable URL
  • Runs entirely in your browser - no CSV ever leaves your machine

Common Use Cases

  • Importing a spreadsheet export into a database without writing schema by hand
  • Bootstrapping a table from a CSV during early prototyping
  • Generating seed data INSERTs from a sample dataset
  • Inspecting how columns would be typed before designing a real schema
  • Converting a CSV report into INSERT statements for a test database
Detected columns5 cols · 3 rows
ColumnSQL typeOverride
first_nameVARCHAR(50)
last_nameVARCHAR(50)
emailVARCHAR(50)
ageINT
cityVARCHAR(50)

Copy, download, share, or pipe to another tool

CREATE TABLE "users" (
  "first_name" VARCHAR(50) NOT NULL,
  "last_name" VARCHAR(50) NOT NULL,
  "email" VARCHAR(50) NOT NULL,
  "age" INT NOT NULL,
  "city" VARCHAR(50) NOT NULL
);

INSERT INTO "users" ("first_name", "last_name", "email", "age", "city") VALUES
  ('John', 'Doe', '[email protected]', 30, 'New York'),
  ('Jane', 'Smith', '[email protected]', 25, 'Los Angeles'),
  ('Michael', 'Johnson', '[email protected]', 35, 'Chicago');

Target

Examples:

Options

Rows per INSERT

175 characters · paste CSV or load an example

Robust parsing

The parser is RFC-4180 friendly: quoted fields keep embedded commas and newlines, "" is treated as an escaped quote, and the delimiter is auto-detected (or pick comma, semicolon, tab, or pipe yourself).

Dialect-aware output

Types and quoting follow your dialect: PostgreSQL gets double quotes and TRUE/FALSE, MySQL gets backticks and TINYINT(1), SQL Server gets brackets and BIT. Empty cells become NULL, and you can override any inferred column type from the preview table.

Everything runs in your browser - no CSV ever leaves your machine.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools