Skip to main content

CSV vs JSON

CSV and JSON are both in wide use and are chosen for different reasons. This page sets them against each other on the things that decide between them, and links to the converters for both directions — every one of which runs in your browser, with the file never uploaded.

The short answer

CSV is rows and columns and nothing else. JSON is values inside values, to any depth. If your data genuinely is a table — one record per line, the same fields every time — CSV is smaller, opens in every spreadsheet, and is readable by anyone. The moment a record needs a list inside it, or an optional nested object, CSV starts requiring conventions that the format itself cannot enforce.

The second difference is types. JSON knows the difference between the number 42, the string "42", and the boolean true. CSV knows only text, which is why a leading zero disappears from a postal code and why a long number turns into scientific notation when a spreadsheet guesses wrong. If the values have to survive a round trip unchanged, JSON is the one that can promise it.

In practice the choice is often made for you by what is on the other end. A spreadsheet wants CSV, an API wants JSON, and arguing with either is more work than converting. Where you do get to choose, the question worth asking is whether anything in the data is ever going to need a list inside a record — because that is the point CSV stops being adequate.

Side by side

CSV and JSON compared on the properties that separate them.
PropertyCSVJSON
Stored asPlain text, readable in any editorPlain text, readable in any editor
What it can holdRows and columnsValues nested inside values
Numbers stay numbersNoYes
CommentsNoNo
Several in one fileNoNo
Published19722001

Where they actually differ

  • They can express different shapes. JSON holds values inside values to any depth; the other is rows and columns, and nesting has to be faked with conventions it cannot enforce.
  • Only JSON knows what kind of value it is holding. In the other everything is text, which is why leading zeros vanish and long numbers turn into scientific notation.
  • They are 29 years apart, and most of what separates them is what had been learned in between.

What people get wrong

  • Converting into the untyped format turns every value into text. Leading zeros disappear, long numbers become scientific notation, and dates come back in whatever form the reading program guesses.

Which to choose

Choose CSV when
Choose CSV for tabular data going into a spreadsheet, and where the recipient may be a person rather than a program.
Choose JSON when
Choose JSON for anything nested, anything with optional fields, and anything where a number has to stay a number.

Converting between them

Common questions

Why does converting CSV to JSON quote all my numbers?
Because CSV carries no types, so a converter cannot know whether 007 is a number, a string, or a product code. Guessing would corrupt some files silently, which is worse than quoting. Where a converter offers to infer types, that option is doing exactly this guessing, and it is worth checking the result before relying on it.
Which of CSV and JSON is better?
Neither, in general — if one were simply better the other would have disappeared. They are good at different things, and the short answer above says which is which. The useful question is what the file has to do next: be edited, be published, be opened by somebody else, or fit inside a size limit.
Does converting between them lose anything?
It depends on the direction. Converting into a format that stores everything loses nothing but does not recover anything either; converting into one that discards detail loses a little each time. The table above says which of these two does which.
Can I convert back afterwards?
The file will convert back, but whether it comes back unchanged depends on the direction. Between two formats that store everything, a round trip is lossless. Where one of them discards detail, that detail is gone and the return journey cannot invent it.
Can I use both?
On a web page, often yes, and it is usually the right answer: serve the smaller modern format and list an older one as a fallback so each browser takes what it understands. For a file you are handing to a person, pick one — the one they can open.
Which one does my software support?
The side-by-side table above says which browsers read each, which is the part that varies most. Desktop support is harder to state in general and tends to lag browsers by years, so if the file is going to somebody else, the older and more widely read of the two is the safer choice.
Is converting between them free?
Yes, with no account and no limit on how many files you convert. Every converter linked from this page runs in your browser: the file is read from your device, converted by code running on it, and handed back as a download.
Is my file uploaded?
No. There is no conversion server here to upload it to, and no third-party service is involved. You can confirm it yourself: open your browser's developer tools, switch to the Network panel with no filter, and run a conversion — no request carries your file.

Ads on this site

Advertising pays for this site. The ads may store cookies to choose what to show you and to avoid repeating themselves. Your files are not involved in any of it — they never leave your browser, whichever button you press, and every tool works either way.

What this covers