CSV vs JSON vs Excel: Which File Format Should You Use?
The three formats you meet most often for tabular data, CSV, JSON and Excel, store the same numbers in very different ways. Choosing the wrong one costs you formatting, precision or compatibility. This guide compares them, explains what is lost when you convert between them, and recommends one for each situation.
The short answer
Use CSV to exchange a plain table between programs, for large data and for anything a script will read. Use JSON when the data is nested or has to be read by a web application or API. Use Excel (XLSX) when people will open the file, and you need several sheets, formulas, formatting or charts. If you are not sure, CSV is the safest default for numbers, because every tool can read it.
CSV: simple, small and universal
A CSV file is plain text, one row per line with values separated by a delimiter, and usually a header row of column names. That simplicity makes it tiny, fast to read and writable by anything from a data logger to a database. It is the standard way to move a table between programs and the usual input for graphing and statistics software.
The costs are that CSV stores everything as text with no data types. A column of dates, numbers and IDs is indistinguishable from text until a program guesses, which is why leading zeros vanish and dates get misread. It has no support for several sheets, formulas, colours or nested structures, and the delimiter, decimal mark and encoding vary between regions (see cleaning a messy CSV).
JSON: structured and nested
JSON (JavaScript Object Notation) writes data as objects with named keys and arrays, and nests them to any depth. A customer can contain a list of orders, each with a list of items. That mirrors how programmers and web APIs think, and it keeps explicit types for numbers, strings, booleans and null. It is the usual format for web services, configuration files and NoSQL databases.
The drawbacks for analysis are size and shape. Every row repeats its key names, so JSON is larger than CSV for the same table, and nested data has to be flattened before it fits a spreadsheet row. When a record has a variable list of items, flattening forces a choice: repeat the parent fields for each item, or create columns such as items.0.name and items.1.name.
Excel (XLSX): rich and human-friendly
An XLSX file is a compressed bundle of XML. It can hold several sheets, typed cells, formulas, number and date formats, merged cells, charts and styling. For a report or a form passed between colleagues it is the most convenient format, and it preserves things CSV cannot.
The same richness makes it heavier and harder to process automatically. Merged cells, header rows spread over two lines, notes in empty cells and formulas make programmatic reading unreliable, and spreadsheet programs have known quirks such as converting gene names like SEPT2 into dates. For raw data you plan to analyse, export one clean sheet as CSV.
Side-by-side comparison
A quick reference for the three formats:
| CSV | JSON | Excel (XLSX) | |
|---|---|---|---|
| Stored as | Plain text | Plain text | Compressed XML |
| Multiple sheets | No | Yes (as nested data) | Yes |
| Nested data | No | Yes | No |
| Data types | None (all text) | Number, string, boolean, null | Typed cells |
| Formulas, formatting | No | No | Yes |
| File size for a plain table | Smallest | Larger (repeats keys) | Compressed, mid |
| Best for | Exchange, analysis, graphing | APIs, web apps | Reports, people |
What gets lost when you convert
CSV → JSON: every value is text, so numbers, booleans and empty cells need type detection. A good converter keeps IDs with leading zeros (00123) and very long numbers as strings, because turning them into numbers corrupts them. JSON → CSV: nested objects must be flattened, and arrays become extra rows or numbered columns. Excel → CSV: only one sheet is exported, formulas become their calculated values, and formatting such as 12% turns into 0.12 unless you export the displayed text. CSV → Excel: nothing is lost, but the program may guess types wrongly, so check dates and IDs after conversion.
The converters on this site all run in your browser, so a file with private data is never uploaded, and two-way pages let you convert back and forth to verify that nothing changed.
Which format for which job
For graphing or statistics, use CSV or a single clean Excel sheet. For handing data to a web page or API, JSON. For sending a table to a colleague who will read it, XLSX. For long-term archiving of raw data, CSV with a short text file describing the columns and units, since plain text will be readable decades from now. And whenever two formats are involved, keep the original and convert a copy so you can always check the result against the source.
Frequently asked questions
- Is JSON better than CSV?
- Neither is better overall. JSON suits nested or typed data and web APIs. CSV suits flat tables, large files and data analysis. A flat table in JSON is bigger and no more expressive.
- Why does Excel change my data when opening a CSV?
- It guesses types for every cell: long numbers become scientific notation, leading zeros are dropped and some text becomes dates. Import via “From text” and mark those columns as Text to prevent it.
- Can CSV handle commas inside values?
- Yes, if the value is wrapped in double quotes, and quotes inside it are doubled. Good parsers handle this, but a naive split on commas does not.
- Which format is smallest?
- CSV for plain tables. XLSX is compressed, so it can be close in size, while JSON is the largest because every record repeats its key names.
Keep reading
- How to Clean a Messy CSV File – Fix the usual CSV problems: wrong delimiters, decimal commas, title lines, units in cells, NA values, encodings and duplicate rows.
- Which Chart Should I Use? – A practical decision guide for choosing between line, bar, scatter, histogram, box and pie charts, with the question each one answers and the mistakes to avoid.
- Preparing Graphs for Papers, Theses and Lab Reports – How to prepare a publication-quality graph: column widths, vector vs raster, DPI, font size, colour-blind-safe palettes and a checklist.
Written and reviewed by the Plotiq Editorial Team. Spotted a mistake? Tell us and we will correct it. See About Plotiq for how these guides are made.