What is a CSV File? Format, Uses & Examples
A CSV (Comma-Separated Values) file is a plain-text format for storing tabular data — the kind of rows and columns you see in a spreadsheet. Each line in the file is a row, and commas separate the values in that row into columns. Because it is just text, CSV is one of the most portable and widely supported ways to move data between programs.
What is a CSV file?
A CSV file holds a table as text. The first line is usually a header row that names each column, and every line after it is a record. Open a CSV in a text editor and you will see plain rows of values separated by commas; open the same file in a spreadsheet and those commas become column boundaries, turning the text into a neat grid.
CSV files typically use the .csv extension, but under the hood they are ordinary text files. That simplicity is the whole point: almost any tool, from a decades-old database to a modern analytics platform, can read and write CSV.
A simple CSV example
name,role,city
Ada Lovelace,Mathematician,London
Alan Turing,Computer Scientist,Manchester
Grace Hopper,Rear Admiral,New York
The first line defines three columns: name, role, and city. Each following line is one person's record. That is a complete CSV — no special software required to create it.
Why is CSV so widely used?
- Universal support. Spreadsheets, databases, and every major programming language can import and export CSV.
- Human-readable. You can open and understand a CSV in any text editor.
- Compact. With no formatting overhead, CSV files are small and quick to transfer.
- Simple to generate. Producing CSV is as easy as joining values with commas and rows with line breaks.
How the CSV format works
The rules are minimal, which is both a strength and a source of confusion:
- Rows are separated by line breaks.
- Columns are separated by a delimiter — usually a comma, but sometimes a semicolon or tab.
- Quoting handles special characters: if a value contains a comma, a line break, or a double quote, the whole field is wrapped in double quotes, e.g.
"Smith, John". - Escaped quotes inside a quoted field are written as two double quotes (
"").
There is no official standard that every tool follows, which is why CSV files from different sources can behave slightly differently. A CSV validator helps catch rows with the wrong number of columns before an import fails.
CSV vs Excel vs JSON
| Feature | CSV | Excel (.xlsx) | JSON |
|---|---|---|---|
| Format | Plain text | Binary | Plain text |
| Data types | None (all text) | Rich | 6 built-in |
| Formatting & formulas | No | Yes | No |
| Nested/hierarchical data | No | Limited | Yes |
| Best for | Simple tabular exchange | Rich spreadsheets | APIs, nested data |
CSV is ideal for flat, tabular data that needs to move between systems. When your data has nesting — objects inside objects — JSON is the better fit, and you can convert between the two with a CSV to JSON converter.
Common CSV problems (and fixes)
- Values with commas break columns unless they are quoted — always quote fields that contain the delimiter.
- Wrong delimiter — some regions use semicolons; if everything lands in one column, switch the delimiter.
- Inconsistent column counts — a missing or extra comma shifts every following value.
- Encoding issues — accented characters can garble if the file is not saved as UTF-8.
- Leading zeros — spreadsheets may strip leading zeros from codes and ZIP codes on import.
How do you create a CSV file?
There are two common ways to produce a CSV:
- From a spreadsheet — in Excel or Google Sheets, choose File → Save As (or Download as) and pick the CSV format. The current sheet is exported as comma-separated text.
- From code — build each row by joining values with commas and rows with newlines, quoting any value that contains the delimiter. Most languages also have a dedicated CSV library that handles the quoting rules for you.
Where is CSV used in the real world?
- Data exports and imports — moving records between a CRM, database, or analytics tool.
- Machine learning datasets — training data is very often distributed as CSV.
- Financial data — bank and accounting exports commonly use CSV.
- Bulk operations — uploading hundreds of products, users, or contacts at once.
Delimiters beyond the comma
Despite the name, CSV files do not always use commas. When data itself contains commas, a different separator avoids constant quoting:
- TSV uses tabs — handy because tabs rarely appear inside data and paste cleanly into spreadsheets.
- Semicolons are common in regions where the comma is the decimal separator.
- Pipes (
|) are sometimes used for data with lots of punctuation.
If a file opens with everything crammed into one column, the delimiter is usually the culprit — a CSV delimiter converter switches it in one step.
How to work with CSV online
These free browser-based tools process your file locally, so nothing is uploaded:
- CSV Viewer — read a CSV as a clean, sortable table.
- CSV to JSON — convert rows into a JSON array of objects.
- JSON to CSV — turn JSON data into a spreadsheet-ready CSV.
Conclusion
CSV endures because it is the simplest possible way to share a table: plain text, comma-separated, readable everywhere. Understand its quoting rules and its lack of types, and you can move tabular data confidently between spreadsheets, databases, and code. When a file misbehaves, a browser-based CSV tool will get it clean in seconds.
Try the tools
Frequently Asked Questions
What does CSV stand for?
CSV stands for Comma-Separated Values. The name describes the format exactly: values in each row are separated by commas, and each row sits on its own line.
How do I open a CSV file?
You can open a CSV in Excel, Google Sheets, Numbers, or any text editor. For a quick look without a spreadsheet app, paste it into an online CSV viewer that renders it as a sortable table.
Can a CSV value contain a comma?
Yes. If a value contains a comma, a line break, or a double quote, the whole field is wrapped in double quotes so it is not split into extra columns. Internal quotes are doubled.
What is the difference between CSV and Excel?
CSV is a plain-text format with only values — no formulas, colors, fonts, or multiple sheets. An Excel (.xlsx) file is a rich binary format that stores all of that. CSV is more portable; Excel is more capable.
Is CSV still used today?
Very much so. Because it is simple and universally supported, CSV remains the default for exporting and importing data between spreadsheets, databases, analytics tools, and applications.
CodeUtilityKit Team builds free, privacy-first developer tools that run entirely in your browser. Every guide is written and reviewed by developers who use these tools daily.