← All tools
Free tool

CSV to SQL converter

Drop in a CSV and get a PostgreSQL CREATE TABLE with detected column types, plus INSERT statements for every row. Runs entirely in your browser, your file never uploads.

input.csv · 3 rows
output.sql · id: integer, name: text, email: text, signup_date: date, is_active: boolean, score: double precision
CREATE TABLE imported (
  id integer PRIMARY KEY NOT NULL,
  name text NOT NULL,
  email text,
  signup_date date NOT NULL,
  is_active boolean NOT NULL,
  score double precision NOT NULL
);

INSERT INTO imported (id, name, email, signup_date, is_active, score) VALUES
(1, 'Ada Lovelace', 'ada@example.com', '2024-01-15', TRUE, 98.5),
(2, 'Grace Hopper', 'grace@example.com', '2024-02-20', TRUE, 87),
(3, 'Alan Turing', NULL, '2024-03-10', FALSE, 92.25);

Frequently asked questions

How do I import a CSV into PostgreSQL?

Two paths: paste the generated INSERT statements into psql for small files, or, for large files, use the generated CREATE TABLE then load with \copy tablename FROM 'file.csv' WITH CSV HEADER. This tool gives you both the table definition and the INSERTs, so either path starts here.

Is it free?

Yes, completely free with no signup and no row limits in the browser. Files up to a few thousand rows convert instantly; the output caps INSERTs at 1000 rows with a note, so split very large files before importing.

Is my data uploaded anywhere?

No. Parsing and type detection run entirely in your browser with no server round-trip. Your CSV is never uploaded, stored, or logged, you can safely convert files with real customer data.

Which column types are detected?

integer, bigint, double precision, boolean, date, timestamptz, uuid, and text, with nullability inferred from empty cells. If every value in the first column is unique, it becomes the PRIMARY KEY. Mixed or ambiguous columns safely fall back to text.

Can I turn the result into an ER diagram?

Yes. Click Visualize this schema to open the generated SQL in dbdiagramr as an interactive ER diagram, useful for sanity-checking the inferred types and keys before you run anything against production.

Related tools

Turn it into an ER diagram

Paste your PostgreSQL connection string and get an interactive ER diagram of your own schema in under 10 seconds. No signup required.