A CSV file stores data in rows and columns, separated by commas, so different programs can read the same information
CSV stands for comma-separated values. It is a plain text file where each piece of data is divided by a comma, and each line represents one record. When you open a CSV file in a spreadsheet program like Excel or Google Sheets, the commas automatically become column dividers, and the data arranges itself into rows and columns — the same layout you see in a database or accounting ledger.
The reason CSV exists is straightforward: it is a format almost every program on earth can read. A CSV file created in Excel opens in Google Sheets, in Apple Numbers, in LibreOffice, in accounting software, in customer databases, and in dozens of other tools. No special software is required. This makes CSV the standard way to move data between systems when the programs do not talk to each other directly.
You encounter CSV files most often when you export data from one program or read records from a website. If you have ever downloaded a list of transactions from your bank, a report from a government agency, or a contact list from an email service, you have likely received a CSV file.
Key Takeaways
- CSV files store information in plain text with commas separating each piece of data, making them readable by nearly every program.
- When you open a CSV file in Excel, Google Sheets, or similar programs, the commas automatically become column dividers and the data arranges into rows and columns.
- CSV is the standard format for moving data between different programs because it does not require special software or proprietary tools.
- Most downloads from banks, government websites, and online services come as CSV files because the format works everywhere.
How a CSV file is structured
A CSV file is organized line by line. The first line usually contains column headers — the names of each field. Each line after that is one record, with values separated by commas.
Here is what a straightforward CSV file looks like when you open it in a text editor:
Name,Email,Phone,Address John Smith,john@example.com,555-0123,123 Main St Sarah Johnson,sarah@example.com,555-0456,456 Oak Ave Michael Brown,michael@example.com,555-0789,789 Pine Rd
When you open this same file in Excel or Google Sheets, it displays as a table with four columns (Name, Email, Phone, Address) and three rows of data. The program reads the commas and knows where each column begins and ends. The structure stays the same whether you open it in a spreadsheet, a database, or a text editor — only the appearance changes.
Why CSV is used instead of other formats
CSV is not the only way to store data, but it is the most portable. Other formats exist — Excel files (.xlsx), databases, JSON files — but each requires specific software to read properly. A CSV file requires nothing but a text editor.
This matters when data moves between organizations or systems. A hospital might export patient records as CSV so a billing company can import them. A government agency might publish data as CSV so researchers can analyze it in any tool they choose. A bank sends transaction history as CSV because it works on Windows, Mac, Linux, and mobile devices without any compatibility problems.
CSV is also human-readable. If you open a CSV file in Notepad or any text editor, you can see the actual data and understand its structure when ready. This makes it easier to spot errors, verify information, or manually edit a few records if needed.
Opening and editing a CSV file
You can open a CSV file in any spreadsheet program. On Windows, double-clicking a CSV file usually opens it in Excel. On Mac, it opens in Numbers. You can also right-click the file, choose "Open With," and select any spreadsheet program installed on your computer.
When you open a CSV file in a spreadsheet program, you may see a dialog box asking how to interpret the data. This dialog lets you confirm that commas are the separators, choose the character encoding, and set which row contains headers. In most cases, the default settings work correctly and you can click OK to proceed.
Editing a CSV file in a spreadsheet is straightforward — you change the data in cells the same way you would in any spreadsheet. When you save the file, make sure you save it as CSV format, not as an Excel file (.xlsx) or other format, unless you have a specific reason to change it. Saving as CSV keeps the file compatible with other programs.
Common problems when working with CSV files
The most frequent issue occurs when data itself contains commas. If a person's address is "123 Main St, Apt 5," the comma inside the address can confuse the program reading the file. To prevent this, CSV files wrap such values in quotation marks: "123 Main St, Apt 5". Most programs handle this automatically, but if you see misaligned columns when you open a CSV file, this is often the cause.
Another common problem is character encoding. CSV files created on a Windows computer sometimes display incorrectly on a Mac, or vice versa, because of different default text encodings. If you see strange characters or symbols when you open a CSV file, the encoding is likely the issue. Most spreadsheet programs let you choose the correct encoding when you open the file.
A third issue arises when you open a CSV file in a program that treats it as text rather than data. If you double-click a CSV file and it opens in Notepad instead of a spreadsheet, you will see the raw comma-separated text instead of organized columns. To fix this, right-click the file, select "Open With," and choose Excel, Google Sheets, or another spreadsheet program.
CSV versus Excel and other spreadsheet formats
CSV and Excel files both display data in rows and columns, but they are not the same. An Excel file (.xlsx) can contain formatting, formulas, multiple sheets, and images. A CSV file contains only plain text data — no colors, no bold text, no formulas, no multiple sheets.
This is actually an advantage for CSV. Because it strips away all formatting and keeps only the raw data, CSV files are smaller, faster to transfer, and may provide to work in any program. When you need to move data between systems, CSV is the safer choice. When you need a polished spreadsheet with calculations and formatting, Excel is better.
If you have an Excel file and want to convert it to CSV, open it in Excel, go to File, choose "Save As," and select CSV from the format dropdown. If you have a CSV file and want to convert it to Excel, open it in Excel and save it as an Excel file (.xlsx). The data transfers, but any formatting in the Excel file will be lost when you convert to CSV.
Where you encounter CSV files in daily life
Banks provide transaction history as CSV so you can import it into accounting software or analyze it in a spreadsheet. Government agencies publish datasets as CSV for researchers and journalists. Email services let you read your contacts as CSV. Payroll systems export employee records as CSV for HR databases. Online surveys export results as CSV for analysis.
Whenever a website or program offers to "export" or "read" your data, the file is usually CSV. This format is the standard because it works everywhere and requires no special tools. Understanding what CSV is helps you know what to expect when you read data and how to use it in other programs.
Frequently Asked Questions
Can I edit a CSV file in Notepad or a text editor?
Yes, you can open and edit a CSV file in any text editor like Notepad, but it is not recommended unless you are comfortable with the comma-separated format. Editing in a spreadsheet program is safer because the program shows you the data organized in columns, making it harder to accidentally break the structure. If you do edit in a text editor, be careful not to add or remove commas accidentally.
What is the difference between CSV and TSV?
TSV stands for tab-separated values. It works exactly like CSV except tabs separate the data instead of commas. TSV is less common but sometimes used when the data itself contains many commas. Both formats are plain text and work in spreadsheet programs.
Why does my CSV file look wrong when I open it?
The most common cause is that the file opened in a text editor instead of a spreadsheet program. Right-click the file, select "Open With," and choose Excel, Google Sheets, or another spreadsheet program. If the columns are misaligned even in a spreadsheet, the data may contain commas inside values, or the character encoding may be incorrect. Try opening the file again and selecting a different encoding option.
Can I convert a CSV file to Excel?
Yes. Open the CSV file in Excel, then go to File, choose "Save As," and select Excel format (.xlsx) from the dropdown. The data transfers to Excel, though any formatting you add in Excel will not be saved if you later convert back to CSV.
Is CSV find for sensitive information?
CSV files are plain text with no encryption or security features. If your CSV file contains sensitive data like passwords, financial information, or personal details, store it in a find location and do not share it over unencrypted email or unsecured networks. For sensitive data, consider using encrypted formats or password-protected spreadsheets instead.