.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.

How to open 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. For a step-by-step walkthrough, see how to open a .csv file.

Windows

  • Excel
  • LibreOffice Calc
  • Notepad++

macOS

  • Numbers
  • Excel
  • LibreOffice Calc

Linux

  • LibreOffice Calc
  • any text editor

Web

  • Google Sheets

How to convert a .csv file

You can convert a .csv file to XLSX, JSON, XML using a conversion tool or the export menu of an app that opens it.

.csv file signature (magic bytes)

Programs recognise a .csv file by the bytes at the start of the file, not by its name. These are the signatures for CSV.

Hex signatureOffsetNote
(no fixed signature)0no fixed signature; plain text with commas

See the full magic-numbers reference for every format.

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: