🧰FileTools

CSV to SQL Converter

Convert CSV files to SQL INSERT statements instantly in your browser. Proper escaping for quotes, backslashes and newlines. No upload required.

🔒 Ihre Dateien verlassen niemals Ihr GerätMax 50MB.csv · .txt
⬆

Datei hierher ziehen oder klicken zum Auswählen

Unterstützt: .csv, .txt · Max: 50MB

📘 Anleitung

Anleitung auf Englisch verfügbar. Automatische Übersetzung folgt.

How to Convert CSV to SQL INSERT Statements

What This Tool Does

The CSV to SQL Converter transforms comma-separated data into ready-to-execute SQL INSERT statements. Paste your CSV or drop a file, choose a table name, and get properly escaped INSERT statements you can run directly in MySQL, PostgreSQL, SQLite, or any SQL database.

Why Proper Escaping Matters

Naive CSV-to-SQL conversion is a classic source of broken imports and SQL errors. Real-world data contains apostrophes (O'Brien), backslashes (Windows paths like C:\Users), and embedded newlines (multi-line addresses). This tool escapes all of them correctly: single quotes are doubled per SQL standard, backslashes are escaped for MySQL compatibility, and newlines become literal escape sequences. Numeric-looking values are emitted as bare literals so your columns keep proper types where possible; empty cells become NULL rather than empty strings, which matches most import expectations.

How to Use

  1. Paste your CSV (first row must be the header) or drop a .csv file onto the upload zone.
  2. Enter the target table name — this is used verbatim in the generated statements.
  3. Pick the delimiter: comma is standard, but semicolon is common in European exports, and tab or pipe separators are frequent in database dumps.
  4. Click Convert, review the preview, then download the .sql file and run it against your database.

Batch Inserts for Performance

The generated output is a single multi-row INSERT statement when your file has more than a few hundred rows. Multi-row inserts are dramatically faster than one-statement-per-row: a 10,000 row import that takes minutes with individual INSERTs completes in seconds with a single batched statement. If your database has a max packet size limit (MySQL's max_allowed_packet for example), split large files before conversion.

Common Pitfalls This Tool Handles

  • Quoted fields containing delimiters ("Doe, John") are parsed per RFC 4180, not naively split.
  • Doubled quotes inside quoted fields ("say ""hi""") are unescaped during parsing.
  • CRLF line endings from Windows exports are normalized automatically.
  • Header names with spaces are preserved as-is and quoted with backticks-compatible formatting left to your database's identifier rules.

Privacy Note

Your CSV is parsed entirely in your browser with a hand-rolled RFC 4180 parser — no server upload, no data retention. Safe for customer lists, financial exports, and internal data.

❓ Häufige Fragen

Which databases does the output work with?

The generated INSERT statements use standard SQL syntax compatible with MySQL, PostgreSQL, SQLite and SQL Server. String escaping follows the common superset: single quotes doubled, backslashes escaped.

How are empty cells handled?

Empty CSV cells become SQL NULL. If you need empty strings instead, post-process with a find-and-replace on ,'', to ,NULL, before importing.

Is my data uploaded anywhere?

No. Parsing and generation happen entirely in your browser. Your files never leave your device.

Does it support semicolon-delimited European CSV?

Yes. Choose the delimiter option: comma, semicolon, tab, or pipe are all supported.