A CSV file stores data in rows and columns, separated by commas, so any program can read it

CSV stands for "comma-separated values." It is a plain text file that holds data organized into rows and columns — like a spreadsheet — but saved in the simplest possible format. Each row is a new line, and each column is separated by a comma. Because CSV uses only basic text, almost any program can open it: Excel, Google Sheets, Numbers on Mac, or even Notepad.

The reason CSV exists is portability. If you export data from one program and need to use it in another, CSV is the format that works everywhere. A bank might give you your transaction history as a CSV file. A survey tool might let you download results as CSV. A database program can import CSV to load thousands of records at once.

CSV files have a .csv extension, so they appear as "filename.csv" on your computer. When you double-click one, your operating system usually opens it in your default spreadsheet program — Excel on Windows, Numbers on Mac, or Google Sheets if you use Chrome.

Key Takeaways

  • CSV files store data as plain text with commas between columns, making them readable by nearly any program.
  • You can open a CSV file in Excel, Google Sheets, Numbers, or even a text editor like Notepad.
  • CSV is the standard format for moving data between different programs and services.
  • The first row often contains column headers — the names of each data field — which helps organize the information.
  • Editing a CSV file in a text editor can corrupt the data if you are not careful with the comma placement.

How CSV files are structured

A CSV file is organized like a table. The first row typically contains headers — the names of each column. Below that are the data rows, with each value separated by a comma.

Here is a simple example of what a CSV file looks like when you open it in a text editor:

Name,Email,Phone John Smith,john@example.com,555-1234 Sarah Jones,sarah@example.com,555-5678 Mike Brown,mike@example.com,555-9012

When you open this same file in Excel or Google Sheets, it displays as a proper table with "Name," "Email," and "Phone" as column headers, and each person's information in a row below. The program reads the commas and automatically places each value in the correct cell.

Opening a CSV file on Windows or Mac

On Windows, right-click the CSV file and select "Open with." Choose Excel, Google Sheets, or another spreadsheet program. If you want to change the default program, select "Choose another app" and pick the one you use most often.

On Mac, double-click the CSV file. It will open in Numbers (Apple's spreadsheet program) by default. If you prefer Google Sheets or Excel, right-click the file, select "Open With," and choose your preferred program from the list.

If you want to view the raw text inside a CSV file without opening it in a spreadsheet program, you can open it in Notepad (Windows) or TextEdit (Mac). This shows you exactly how the data is stored — commas and all — which is useful if you need to troubleshoot formatting problems.

When to use CSV instead of Excel or other formats

CSV is the best choice when you need to move data between different programs. If you have customer information in one database and need to import it into another, CSV is usually the format both programs accept. Banks, email services, and survey tools often let you download your data as CSV for this reason.

CSV is also smaller than Excel files. An Excel file (.xlsx) contains formatting, formulas, and other features that make the file larger. A CSV file contains only the raw data, so it takes up less storage space and transfers faster over the internet.

However, CSV has limits. It cannot store formulas, colors, multiple sheets, or other formatting that Excel can. If you need those features, keep your file in Excel format (.xlsx) instead. You can always export to CSV later if you need to share the data with another program.

Common problems when working with CSV files

One frequent issue is commas inside the data itself. If a person's name is "Smith, John" and you save it as CSV, the comma in the name can confuse the program reading the file. Most spreadsheet programs handle this by putting quotation marks around values that contain commas — "Smith, John" — so the program knows to treat the whole thing as one cell.

Another problem occurs when you edit a CSV file in a text editor like Notepad. If you add or remove commas by mistake, the columns will not line up correctly when you open it in a spreadsheet program. For this reason, it is safer to edit CSV files in Excel or Google Sheets, which handle the comma placement automatically.

Character encoding can also cause issues, especially with names or text in other languages. Most CSV files use UTF-8 encoding, which handles most characters correctly. If you see strange symbols when you open a CSV file, the encoding may be different. Most spreadsheet programs let you choose the encoding when you open the file.

How to create your own CSV file

The easiest way is to create a spreadsheet in Excel or Google Sheets, enter your data, and then export it as CSV. In Excel, go to File > Save As, choose CSV as the file type, and click Save. In Google Sheets, go to File > Download > Comma Separated Values (.csv).

You can also create a CSV file in a text editor. Open Notepad or TextEdit, type your data with commas between columns and line breaks between rows, and save the file with a .csv extension. This method works but is error-prone if you have a lot of data or complex formatting.

CSV vs. other file formats

Excel files (.xlsx) are more powerful than CSV. They can store multiple sheets, formulas, colors, and other formatting. However, not every program can read Excel files. CSV works everywhere.

TSV files (tab-separated values) are similar to CSV but use tabs instead of commas to separate columns. They work the same way and serve the same purpose — moving data between programs — but are less common.

JSON and XML are other formats for storing data, but they are more complex and designed for different purposes. For simple tables of information, CSV is usually the right choice.

Frequently Asked Questions

Can I edit a CSV file in Excel without breaking it?

Yes. Open the CSV file in Excel, make your changes, and save it. Excel handles the commas and formatting automatically. Avoid editing CSV files in Notepad or other text editors unless you are certain about comma placement, as mistakes there can corrupt the data structure.

What happens if my data contains a comma?

Most spreadsheet programs automatically put quotation marks around values that contain commas, so "Smith, John" stays as one cell instead of splitting into two. When you open the file again, the program reads the quotation marks and knows to keep that data together.

Is CSV the same as an Excel file?

No. CSV is a simpler, plain-text format that any program can read. Excel (.xlsx) files are more complex and can store formulas, colors, and multiple sheets. You can save an Excel file as CSV to share it with other programs, but you will lose formatting and formulas in the process.

Can I open a CSV file on my phone?

Yes. On iPhone, you can open CSV files in Numbers or Google Sheets. On Android, Google Sheets, Microsoft Excel, or other spreadsheet apps will open CSV files. Download the app from your phone's app store and open the CSV file from your email or file manager.

Why would a company send me a CSV file instead of an Excel file?

CSV is universal — it works on any computer, phone, or program without compatibility issues. Excel files sometimes have version problems or require the program to be installed. CSV is also smaller and faster to download, which matters when sending large amounts of data.