.csv

What is a .csv file?

Comma-Separated Values · Data · Universal · 1970s

CSV is the simplest way to store a table. Each line is a row and commas separate the columns, so it opens in any spreadsheet and imports into almost any database or program, making it the lingua franca of tabular data.

Category
Data
MIME type
Type
Plain text
Is a .csv file safe to open? Mostly safe, with one caveat: opening a CSV in a spreadsheet can trigger formula injection if a cell starts with an equals sign. Import as text if the source is untrusted.

What is a .csv file used for?

A CSV file is plain text where each row sits on its own line and columns are split by commas. That is the whole format, which is exactly why it is so portable.

Every spreadsheet, database and data tool can read and write CSV, so it is the default for exporting and moving data between systems.

Its simplicity has edges: values containing commas or line breaks must be quoted, and CSV carries no formatting, formulas or data types. For those you need XLSX.

What opens a .csv file?

The .csv format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.

Windows

  • Excel
  • LibreOffice Calc
  • Notepad++

macOS

  • Numbers
  • Excel
  • LibreOffice Calc

Linux

  • LibreOffice Calc
  • any text editor

Web

  • Google Sheets

Open a .csv file step by step

  1. Confirm the file really is a .csv. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with Excel or LibreOffice Calc.
  3. On Mac, use Numbers or Excel.
  4. On Linux, try LibreOffice Calc or any text editor.
  5. Still stuck? Convert the .csv to XLSX, which opens more widely.

Why can't I open my .csv file?

Almost always because no installed app understands CSV. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .csv at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

How to convert a .csv file

You can convert a .csv file to XLSX, JSON, XML.

LibreOffice Calc and Excel both open CSV and save to XLSX. Watch the import dialogue: leading zeros in postcodes and long numeric IDs get eaten silently if the column is not set to text.

CSV has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.

Frequently asked questions

What is a .csv file?

CSV is the simplest way to store a table. Each line is a row and commas separate the columns, so it opens in any spreadsheet and imports into almost any database or program, making it the lingua franca of tabular data.

Why does my CSV look wrong in Excel?

Excel may guess the wrong delimiter or encoding. Use Data, From Text/CSV to import and pick the correct separator and encoding.

What is the difference between CSV and XLSX?

CSV is plain text with just values. XLSX is a full spreadsheet with formatting, formulas, charts and multiple sheets.

Comparisons

Related formats

Sources

Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.