CSV to JSON & SQL Converter
Paste CSV to turn it into a JSON array of objects or SQL INSERT statements. Quoted fields with embedded commas and line breaks are handled, and rows with a different number of fields are flagged. Nothing leaves your browser.
More from CSVFormat
Guides
Frequently Asked Questions
Is my data sent to a server?
No. Parsing, formatting, and conversion all happen in your browser, so nothing leaves the page.
Can CSVFormat convert CSV to SQL INSERT statements?
Yes. Pick the SQL output mode and the tool emits INSERT INTO statements with quoted values and a header-derived column list, which is the usual way to load a spreadsheet export into a table.
Why does my file look wrong when I paste it?
The delimiter is probably not a comma. Files exported from European locales often use semicolons, and some spreadsheet apps default to tabs. Switch the delimiter setting and re-paste.
🧭 Pro Tips & Gotchas
What this tool does
- Parses with a real RFC 4180 state machine, not
split(","): quoted fields may contain commas, newlines, and""escapes, and CRLF line endings are tolerated. - The JSON and SQL conversions are record-oriented: the first row becomes header keys / column names, remaining rows become records.
- Ragged rows are counted and surfaced as an explicit warning in both the row counter and the SQL output, rather than being silently padded or truncated.
- SQL literals are only unquoted when the value round-trips as a finite number, so
""and whitespace-padded strings stay quoted and cannot become bare SQL tokens. Column names that are not bare identifiers get double-quoted.
CSV is not a line format — this is the big one
- RFC 4180 allows a quoted field to contain commas, quotes, and newlines. A naive
split(",")/split("\n")parser silently produces the wrong column count for any file with an embedded newline in a quoted field — which Excel, Stripe, and most payment exports emit routinely. This parser handles all three cases. - A doubled quote (
"") inside quotes is the escape for one literal quote. Without quote handling,"He said ""hi"", loudly"becomes three fields instead of one. - Consequence for the SQL conversion: a mis-split row shifts every value one column right, and the generated
INSERTstill looks syntactically valid. Wrong data with correct syntax is the worst failure mode — hence the ragged-row warning above. - Excel writes
ID,NAMEasID,"NAME"only when needed, so the same export can parse fine one week and break the next. Test against the messy sample, not the clean one. - UTF-8 CSVs from Excel usually carry a BOM. If your first header arrives as
id, the BOM was not stripped. - Numbers arrive as text on purpose:
007,1.2E3,12,34(European decimal comma), and=SUM(A1:A9)all exist in real exports. A spreadsheet that re-parses them has already corrupted the data before you see it — and a CSV starting with=,+,-, or@is a formula-injection vector when opened in Excel. - Delimiter detection is guesswork. A file that mixes
;and,(common in EU locales) will parse "successfully" into nonsense every time.
For anything real
Use a proper parser instead of splitting: Python csv with QUOTE_MINIMAL, Node csv-parse, Go encoding/csv, or DuckDB read_csv — all handle quoting, embedded newlines, and BOM correctly, and DuckDB will cast types for you.