Skip to content

BlogData6 min read

CSV, Excel or JSON: which format for your data?

We saved the same 100,000 row table as CSV, as an Excel workbook and as JSON, then compared the sizes, how fast each one reads in code, and what goes wrong with dates, leading zeros and long numbers.

Three cards showing the same data as CSV, as an Excel sheet and as JSON.

Tables of data move between people and programs in three main formats: CSV, Excel workbooks (XLSX) and JSON. Each one is the natural choice somewhere, and each one causes a familiar kind of trouble when it ends up in the wrong place. To compare them on equal terms, we saved one table in all three and measured size and reading speed, then looked at what each format can and cannot hold.

The test table

The table is 100,000 sales orders with seven columns: an order number, a date, a country, a product, a quantity, a unit price and a total. The first rows look like this as CSV:

order_id,date,country,product,quantity,unit_price,total
100000,2025-11-30,Brazil,Water bottle,6,158.35,950.1
100001,2025-02-25,France,Office chair,7,158.73,1111.11

and like this as JSON:

[
  {
    "order_id": 100000,
    "date": "2025-11-30",
    "country": "Brazil",
    "product": "Water bottle",
    "quantity": 6,
    "unit_price": 158.35,
    "total": 950.1
  },
  ...
]

File size

The same 100,000 rows in each format
  • XLSXsaved by Excel4.5 MB
  • CSV5.0 MB
  • JSONcompact12.4 MB
  • JSONindented17.0 MB

Sizes in megabytes (MiB). JSON repeats every column name in every row, which is why it is two and a half times the size of CSV.

An Excel file is a ZIP archive of XML documents, so it arrives compressed, and Excel stores each distinct text value once in a shared list. That makes it slightly smaller than the CSV here. JSON is the largest by far: every row repeats "order_id", "date" and the other keys, and indentation adds more than a third on top.

The picture changes once files are compressed, as they are in transit when a web server sends them with gzip:

FormatSizeWith gzip
CSV5.03 MB1.36 MB
JSON, compact12.37 MB1.63 MB
JSON, indented16.95 MB1.72 MB
XLSX, saved by Excel4.46 MBalready compressed
Repeated keys are exactly what compression removes, so compressed JSON is only about 20 percent larger than compressed CSV.

Reading speed

Size matters less than you might think on a modern connection. How fast a program can turn the file back into rows matters more when the data is large. We read each file back with the libraries our data tools use, taking the median of five runs:

FormatRead into rowsLibrary
JSON, compact0.12 sJSON.parse, built into JavaScript
CSV0.47 sPapa Parse
XLSX10.2 sSheetJS
Node.js on a desktop computer. Microsoft Excel itself opened the CSV in 1.5 s and the XLSX file in 2.1 s.

JSON wins in code because every language ships a fast native parser and the types come for free. CSV needs a parser that handles quotes and converts text to numbers. XLSX is the slowest by a wide margin outside Excel: the program has to unzip the file, parse a large XML document and resolve shared strings and styles. If a script or a web app has to read large tables often, XLSX is the wrong format to feed it.

What each format can hold

CSVXLSXJSON
Data typesText onlyNumbers, text, dates, booleansNumbers, text, booleans, null
Several tablesNo, one per fileYes, as sheetsYes, as nested objects
Nested dataNoNoYes
Formulas and formattingNoYesNo
Row limitNone1,048,576 rowsNone
Readable in a text editorYesNoYes
Opens in ExcelYes, with careYesWith Power Query or a converter

Where CSV goes wrong

CSV looks like the simplest format, and its lack of rules is exactly why it causes the most problems. The same few issues come up again and again:

  • Leading zeros disappear. Postcodes, product codes and phone numbers such as 02134 become 2134 when a spreadsheet guesses that they are numbers.
  • Long numbers lose digits. Excel keeps 15 significant digits, so a 16 digit card or account number quietly changes its last digit.
  • Dates get reinterpreted. 03/04/2025 is 3 April in most of the world and 4 March in the United States, and spreadsheets convert such values as they open the file. ISO dates like 2025-04-03 avoid the guessing.
  • The separator depends on the country. Where the decimal mark is a comma, as in France or Germany, Excel expects semicolons between fields, so a comma separated file opens as one long column.
  • Accents turn into symbols. Excel reads a UTF-8 CSV correctly only when the file starts with a byte order mark. Without it, "Café" may show as "Café".
  • Commas inside values must be wrapped in quotes, and quotes inside quoted values doubled. Hand-made CSV often gets this wrong.

None of this happens with XLSX or JSON, which store types explicitly. With CSV, the safest habit is to open it through Excel's import screen (Data, From Text/CSV), where you can set each column's type, instead of double-clicking the file.

Which one to use

  • Sending a table to a person who will look at it, sort it or add formulas: XLSX. It keeps types and formatting and opens correctly everywhere Excel, Google Sheets, Numbers or LibreOffice is available.
  • Exchanging data between systems, importing into a database or archiving plain data: CSV, with UTF-8 encoding, ISO dates and a header row. It is universal, compact and readable decades from now.
  • Data for a web app or an API, or anything with nested structure: JSON. It is the native format of JavaScript and the fastest to read in code.

Converting between them is usually the easy part. Our Excel and CSV converter turns XLSX, XLS and ODS into CSV or JSON sheet by sheet and builds Excel files from CSV, TSV or JSON, the CSV viewer opens large CSV files with sorting and filters, and the data converter moves between JSON, CSV, YAML and XML. They all run in the browser, so the data never leaves your device.

Questions and answers

Is CSV or Excel smaller?

In our test an Excel file saved by Excel was slightly smaller (4.5 MB) than the same data as CSV (5.0 MB), because XLSX is compressed internally. Zipped, the CSV would be much smaller (about 1.4 MB with gzip).

Why does Excel remove the zeros at the start of my numbers?

Excel guesses that the column holds numbers when it opens a CSV file. Import the file through Data, From Text/CSV and set that column to Text, or keep the data as XLSX.

Can JSON be opened in Excel?

Yes, through Power Query (Data, Get Data, From File, From JSON), or by converting it to CSV or XLSX first. Flat lists of objects convert cleanly; nested data has to be flattened into columns.

How many rows can Excel open?

An Excel worksheet holds at most 1,048,576 rows and 16,384 columns. Larger CSV files open partly, so use a viewer that streams the file or split it.

Tools in this article

More from the blog

Data6 min read

ZIP, 7z or RAR: which archive format is best?

We packed the same folders of photos, videos, documents and data into ZIP, 7z and RAR archives and measured size and speed. The winner depends almost entirely on what is inside.

Data5 min read

QR code error correction and size: L, M, Q and H tested

Higher error correction lets a QR code survive damage, but it also makes the code denser. We generated codes for four common kinds of content at every level and covered them bit by bit until they stopped scanning.

Data5 min read

Unix timestamps explained

A Unix timestamp is just a count of seconds, yet it causes a steady stream of bugs. What it counts, how to tell seconds from milliseconds at a glance, what happens with time zones and leap seconds, and why 2038 matters.

Esc