CSV Formatter
text / csv CSV Formatter
Tidy up CSV data in your browser. Align columns so a raw file becomes readable, normalize inconsistent quoting, convert between CSV and JSON, and preview the result as a table. Quoted fields containing commas, quotes, or line breaks are handled correctly. Nothing is uploaded — exports containing customer data stay on your device.
What the actions do
Align columns
Pads each column to a common width so values line up when read as plain text. This is for reading, not for machines: the padding is real whitespace, so the result is wider than the original and should not be fed back into a parser that treats spaces as significant.
Normalize
Re-emits the file with consistent quoting — every field quoted only where the rules require it, and doubled quotes written correctly. Files assembled by hand or by string concatenation often over-quote or under-quote, and normalizing settles it.
CSV to JSON
Turns each row into an object keyed by the header row, or into an array of arrays when the header option is off. Every value stays a string, because guessing types is where CSV conversion usually goes wrong — see the note about leading zeros below.
JSON to CSV
Flattens an array of objects into rows. The header is the union of every key seen across all objects, so a record with an extra field does not lose it; objects missing a key get an empty cell. Nested objects and arrays are written as JSON text inside the cell.
The quoting rules
RFC 4180 is the closest thing CSV has to a specification, and it is worth knowing that it is descriptive rather than universally obeyed — plenty of software emits something close to it but not identical. Its rules: a field containing a comma, a quote or a line break must be quoted, and a literal quote inside a quoted field is doubled.
CSV looks trivial until a value contains a comma. The convention, set out in RFC 4180, is short:
- A field containing the delimiter, a double quote, or a line break must be wrapped in double quotes.
- A double quote inside a quoted field is written twice:
"she said ""hi"""holds the textshe said "hi". - A quoted field may span multiple lines. A newline inside quotes is part of the value, not the end of a row — which is why splitting a CSV file on newlines is a bug waiting to happen.
- Fields that need no quoting should not be quoted.
Delimiters beyond the comma
The C in CSV is aspirational. Semicolons are standard across much of Europe, where the comma is the decimal separator and using it as a field separator would be ambiguous — this is why a spreadsheet exported in one locale opens as a single mangled column in another. Tabs and pipes appear wherever the data itself is full of commas. Use Detect delimiter to have the first line inspected, or pick one directly.
Common uses
- Reading an export.Analytics, billing, and CRM exports arrive unaligned; aligning columns makes them scannable without a spreadsheet.
- Preparing a fixture.Convert a CSV sample into JSON to seed a test or mock an API response.
- Producing a spreadsheet.Convert an API response in JSON into CSV for someone who works in Excel or Google Sheets.
- Fixing an import that keeps failing.Normalizing quoting resolves most rejected uploads, which are usually caused by an unescaped quote several thousand rows down.
- Checking row and column counts.The preview reports how many rows parsed, which catches a stray newline splitting one record into two.
Things that trip people up
- Leading zeros vanish in spreadsheets.A ZIP code of
01234or a phone number becomes a number and loses its zero. This tool keeps every value as text, but the spreadsheet you open the file in may not. - Long digit strings lose precision.Credit card numbers and long identifiers get rounded when a spreadsheet treats them as numbers.
- Newlines inside quoted fields.A single address field containing a line break is entirely legal and breaks every naive line-by-line parser.
- The byte order mark.Files exported from Excel often begin with an invisible BOM, which turns the first header into something that will not match by name.
- Ragged rows.Nothing enforces that every row has the same number of fields. The preview pads short rows so you can spot them.
Frequently asked questions
Why are my numbers still strings after converting to JSON?
NaN or 1e5 turn into something unintended. Keeping everything as text means nothing is silently altered, and you can convert the fields you know about.