What is CSV? Complete Guide with Examples
CSV (Comma-Separated Values) is a plain-text file format that stores tabular data where each line represents a row and values within a row are separated by commas. The first line typically contains column headers. Despite its simplicity, CSV is one of the most widely used data interchange formats, supported by spreadsheet applications (Excel, Google Sheets), databases, and virtually every programming language.
Use our free tools to experiment with csv (comma-separated values).
How Does CSV (Comma-Separated Values) Work?
CSV files store data as plain text with a simple structure: each line is a record, and fields within a record are separated by commas. When a field contains a comma, newline, or double quote, the entire field is enclosed in double quotes. Double quotes within a field are escaped by doubling them (""). Parsers read line by line, splitting on commas while respecting quoted fields. While there's an RFC (4180) defining the format, implementations vary — some use semicolons, tabs, or pipes as delimiters.
Key Features
- Universal compatibility — readable by Excel, Google Sheets, databases, and all programming languages
- Human-readable plain text that can be opened in any text editor
- Compact format with minimal overhead compared to JSON or XML
- Simple structure: rows as lines, columns as comma-separated values
- Support for quoted fields containing commas, newlines, and special characters
Common Use Cases
Data Export and Import
Databases, CRMs, and analytics platforms export data as CSV for portability. CSV is the lingua franca for moving data between systems that may not share APIs or native formats.
Spreadsheet Data Exchange
Users share tabular data via CSV because it's supported by Excel, Google Sheets, LibreOffice, and Numbers. It ensures the data structure transfers regardless of which application opens it.
Machine Learning Datasets
CSV is the standard format for sharing datasets in data science. Libraries like pandas (Python) have first-class CSV reading/writing support for data analysis and ML pipelines.