CSV vs XLS vs XLSX

How CSV, XLS and XLSX differ, what converting between them keeps or loses, and how to choose a format for sharing, importing or archiving tabular data.

CSV, XLS and XLSX can all hold rows and columns, but they store very different things. CSV is plain text. XLS and XLSX are spreadsheet workbook formats that can also store formulas, formatting, multiple sheets and other workbook features. Choosing between them comes down to what has to survive the trip: only the values, or the whole workbook.

What each format actually is

  • CSV (comma-separated values): a plain-text file. Each line is a record, and a delimiter separates the fields. RFC 4180 describes a common convention, but applications differ in practice, so CSV is better treated as a family of similar formats than as one strict standard.
  • XLS: the older binary workbook format used by Microsoft Excel through Excel 2003. It is still widely readable, but it is a legacy format.
  • XLSX: the default workbook format since Excel 2007. It is a ZIP package of XML files based on Office Open XML, which is standardized as ECMA-376 and ISO/IEC 29500.

Side-by-side comparison

Feature | CSV | XLS | XLSX
Storage | Plain text | Binary | Zipped XML package
Multiple sheets | No, one table per file | Yes | Yes
Formulas | No, only values or text that looks like a formula | Yes | Yes
Cell formatting, column widths, colors | No | Yes | Yes
Data types (date, number, text) | No, everything is text until an app interprets it | Yes | Yes
VBA macros | No | Yes | No (macro-enabled workbooks use XLSM)
Published grid size | Not defined by the format | 65,536 rows by 256 columns per sheet | 1,048,576 rows by 16,384 columns per sheet
Readable in a text editor | Yes | No | No (only after unzipping, and then as XML)

The grid sizes are Microsoft's published Excel specifications. A CSV file has no row limit of its own, but the program that opens it does. A CSV with more rows than a worksheet allows will not load completely into a single sheet.

What conversion changes

Converting between these formats changes the container, and sometimes what the data means. Converting does not reorder or restyle characters. It decides what gets kept, flattened or interpreted.

XLS or XLSX to CSV

  • Only one sheet is exported, usually the active one. Other sheets need separate exports.
  • Formulas are replaced by their last calculated values.
  • Formatting, merged cells, comments, charts, images, data validation and macros are dropped.
  • Numbers and dates are written as text. Depending on the application and settings, the text may follow the cell's display format, not the full underlying value. A rounded display can therefore export as a rounded number.
  • The character encoding and the delimiter depend on the export option you pick and on regional settings. In regions that use a comma as the decimal separator, spreadsheet software often uses semicolons as the delimiter.

CSV to XLS or XLSX

Converting in this direction adds structure, and the spreadsheet application has to guess at that structure. When a CSV is opened directly, the guesses can change values. Common problems:

  • Leading zeros in codes such as ZIP codes, phone numbers or product IDs can disappear when the value is read as a number.
  • Long digit strings can be shown in scientific notation or lose precision past the digit limit the application supports for numbers.
  • Text that resembles a date, such as certain gene names or part numbers, can be converted to a date.
  • Non-ASCII characters can be garbled if the file's encoding is not what the application assumes. UTF-8 files without a byte order mark are a frequent cause.

To avoid these problems, use the application's import feature, not a double-click. An import lets you set the encoding and delimiter and mark sensitive columns as text. Recent Excel versions also have options to turn off some automatic data conversions. Which options are available depends on the version, so check your own installation.

XLS to XLSX and back

Upgrading XLS to XLSX usually preserves values, formulas and formatting. Macros are the exception. A workbook that contains VBA has to be saved as XLSM to keep them, because XLSX does not store macros. Downgrading XLSX to XLS can lose data beyond the older grid limits and features the older format lacks. Excel's compatibility checker reports these issues before you save.

How CSV quoting works

Under the RFC 4180 convention, a field that contains the delimiter, a double quote or a line break is wrapped in double quotes, and a literal double quote inside it is doubled. Tools that split lines on every comma, without handling quotes, will break such rows.

id,name,note
00721,"Smith, Jane","Said ""ship Monday"""
00845,Lee,"Line one
Line two"

In this sample, the id column has leading zeros that a spreadsheet may strip unless the column is imported as text. The second record's note field spans two physical lines but is still one record.

Where TSV fits

TSV (tab-separated values) follows the same idea with a tab as the delimiter. Tabs are rare inside ordinary text, so TSV often needs less quoting than CSV. When you copy a range of cells from a desktop spreadsheet application such as Excel and paste it into a plain-text editor, it typically arrives as tab-separated lines. That makes TSV a convenient intermediate for quick copy-and-paste. The exact clipboard behavior depends on the application and the destination, so check the pasted result before you rely on it.

Will the converted file work where you need it?

  • Databases, scripts and import tools: CSV or TSV is usually the expected input. Check the target's documentation for the delimiter, encoding, header row and quoting rules it requires.
  • People who will edit the data in a spreadsheet: XLSX keeps types, formatting and multiple sheets, and current spreadsheet applications widely support it.
  • Recipients on very old software: XLS may be needed, within its smaller grid and feature limits.
  • Long-term archiving of raw data: plain-text CSV with UTF-8 encoding and a documented column list stays readable without any particular application. Add a separate note for anything CSV cannot express, such as units or formulas.
  • Version control and diffs: CSV changes show up line by line. XLSX changes do not, because the file is a compressed package.

Accessibility considerations

A CSV header row is just the first line of text. Whether a screen reader announces those values as column headers depends on the application that opens the file, not on the CSV itself. In a text editor, the content is typically read as delimited lines. An XLSX workbook can hold structure such as named tables, sheet names and alternative text for images, which spreadsheet accessibility features can use. Converting to CSV removes all of that. If accessibility matters to recipients, test the file in the application and assistive technology they actually use. No general guarantee applies across tools.

Security and sensitive data

  • Formula injection: a CSV field that begins with characters such as =, +, - or @ may be treated as a formula when the file is opened in a spreadsheet. If a CSV contains untrusted input, sanitize those fields before others open it in spreadsheet software.
  • Macros: XLS and XLSM files can contain macros. XLSX cannot, which is one reason some organizations prefer it for files from outside sources.
  • Online converters: uploading a file to a web-based converter sends its contents to a third party. Do not upload personal, financial or confidential data unless you have checked that service's handling and retention terms. Converting locally in a spreadsheet application or with a script avoids the upload.
  • Hidden content: XLS and XLSX files can carry hidden sheets, hidden columns, comments and document metadata that a recipient may not expect. Exporting to CSV removes these, but check the workbook before sending it as-is.

Choosing by situation

Situation | Recommended format
Importing into a database, CRM or script | CSV or TSV, matching the target's documented settings
Sharing a workbook with formulas, formatting or several sheets | XLSX
Workbook that must keep VBA macros | XLSM (or XLS for very old setups)
Recipient limited to software from before Excel 2007 | XLS, within its limits
Archiving raw tabular data for the long term | UTF-8 CSV plus a short description of the columns
Tracking changes in version control | CSV or TSV

What this guide does not cover

This comparison relies on the published format specifications and general, widely documented behavior. It is not based on tests of specific converters, application versions or assistive technologies. Import defaults, automatic data conversion, clipboard handling and screen reader output can vary by version, platform and regional settings. Before you commit to a format for an important workflow, run a small sample through the exact tools at both ends and compare the result with the original.