# CSV to SQL > Free CSV to SQL converter that runs in the browser: drop a CSV (comma, semicolon, tab or pipe) and get a CREATE TABLE plus INSERT statements for PostgreSQL, MySQL or SQLite, with column types worked out from every row. Nothing is uploaded. An optional, metered AI step suggests a better table design and the page tests each suggestion against every row before applying it. URL: https://csv-to-sql.skillsafe.ai/ API: https://csv-to-sql.skillsafe.ai/api.html ## What the free converter does (in the browser, no sign-in) - Detects the separator, reads quoted values with separators and line breaks inside, strips a UTF-8 BOM, falls back to Windows-1252 for non-UTF-8 files. - Turns header names into snake_case identifiers, de-duplicates them and quotes reserved words (order, user, group ...). - Picks for each column the most specific type every value fits: boolean, whole number (BIGINT), exact decimal (NUMERIC(p,s) sized to the data), floating point, date, timestamp, timestamp with zone, UUID, JSON, text. - Keeps values with leading zeros (ZIP codes, phone numbers) as text; reads thousands separators, decimal commas (12,50 and 1.250,00) and day/month or month/day dates when the data decides the order; leaves ambiguous dates as text. - Empty cells (and NULL, \N) become NULL; columns with no empty cell get NOT NULL (switchable). - Picks a primary key (a unique, filled-in first column such as id, *_id, *_nr, code) or adds a generated id column. - Writes dialect-correct literals: PostgreSQL TRUE/FALSE, TIMESTAMPTZ with offsets, JSONB, UUID; MySQL VARCHAR/TEXT, DATETIME in UTC, backslash escaping, backtick quoting; SQLite ISO text dates and 1/0 booleans. - Multi-row INSERT batches (1, 100, 500 or 1000 rows) inside one transaction; optional DROP TABLE IF EXISTS. - Rename columns and change types (only types every value fits are offered). Download the .sql script or the table definition alone, or copy either. ## Optional AI step (sign-in, metered) Task id `design`. Sends a summary per column (name, original header, current type, types every value fits, empty and distinct counts, uniqueness, min/max, longest length and, if the visitor allows, up to 5 example values). Never the rows. The model returns JSON: `columns` (type and NOT NULL changes), `primary_key`, `unique`, `checks` (min, max, in, max_length), `indexes`, `notes`. The page applies a suggestion only when every row of the file satisfies it, and lists what it refused and why. ## Sources Adapted from the agent skill @wshobson/postgresql-table-design (MIT), https://skillsafe.ai/skill/@wshobson/postgresql-table-design, from github.com/wshobson/agents.