What is a CSV file? The format explained, with examples

What a CSV file is, what one looks like inside, the quoting rules that trip people up, and how to open, create and convert CSV files without breaking data.

CSV Viewer CSV to Excel Converter

A CSV file (comma-separated values) is a plain-text file that stores a table: each line is one row, and commas separate the values in that row. Because it is just text, almost every program that handles data can read and write it, from Excel and Google Sheets to banks, CRMs, databases and Python.

Here is what a CSV file looks like inside, the rules that decide how it is read, and how to open, create and convert one without corrupting the data.

What a CSV file looks like

Open any CSV in a text editor and you see something like this:

order_id,customer,city,total
1001,Ada Lovelace,London,49.90
1002,"Smith, John",New York,120.00
1003,Grace Hopper,Arlington,15.5

A spreadsheet shows the same file as a grid:

order_id customer city total
1001 Ada Lovelace London 49.90
1002 Smith, John New York 120.00
1003 Grace Hopper Arlington 15.5

The first line is usually a header row naming the columns. Nothing in the file says it is a header, though: the program reading it has to assume so, which is why import screens ask “My data has headers”.

Spreadsheet Table ViewerInteractive in-browser spreadsheet table reader with column sorting, live search filtering, and column summary stats.Open a CSV in your browser

The rules of the CSV format

CSV grew up informally, and the closest thing to a standard is RFC 4180, published in 2005. Its rules are short:

  1. One record per line. Lines end with a line break (CRLF in the RFC, though most software also accepts a plain LF).
  2. Fields are separated by commas. Every row should have the same number of fields.
  3. Quote a field that contains a comma, a quote or a line break. "Smith, John" stays one value instead of splitting into two columns.
  4. Double a quote inside a quoted field. The text 14" monitor is written "14"" monitor".
  5. An optional header line comes first, in the same format as the data.

Rule 3 is the one that causes the most broken imports: a single unquoted comma inside an address or product name shifts every value after it one column to the right.

What a CSV file cannot store

A CSV holds values only. It has no way to record:

  • Data types. 00123, 1-2 and 2026-03-12 are all just text. The program opening the file guesses which are numbers and dates, and that guess is why Excel drops leading zeros and turns part numbers into dates. Our guide to converting CSV to Excel without losing zeros covers the fixes.
  • Formatting. No fonts, colours, column widths or number formats.
  • Formulas. Excel saves the calculated result, not the formula.
  • More than one sheet. Saving a workbook as CSV keeps only the active sheet.
  • The character encoding. Nothing in the file says whether it is UTF-8 or an older code page, so accented letters and other scripts can turn into symbols like é if a program guesses wrong. Save as CSV UTF-8 in Excel to avoid this.

If you need any of these, keep the data in an Excel workbook and export CSV only for the system that asks for it. See CSV vs XLSX for when each format fits.

Delimiters: not always a comma

The “C” in CSV is often a different character:

Separator Where you see it
Comma , The default in the US, UK and most software
Semicolon ; Excel in countries that use a comma as the decimal mark (Germany, France, Brazil and others)
Tab TSV files and data copied out of a spreadsheet
Pipe | Database and mainframe exports

When a file opens with everything crammed into column A, the separator is the problem, not the data.

How to open a CSV file

  • Excel: double-clicking works, but Excel converts types as it opens the file. To control that, use Data > From Text/CSV, choose the delimiter, and set sensitive columns such as IDs and ZIP codes to Text.
  • Google Sheets: File > Import > Upload, then choose the separator or leave it on detect automatically.
  • Apple Numbers or LibreOffice Calc: open the file directly; both show an import dialog.
  • A text editor: Notepad, TextEdit or VS Code show the raw text, which is the quickest way to spot a stray quote or the wrong separator.
  • In your browser: our CSV viewer detects the delimiter, shows the table with search, sorting and paging, and reads the file on your device without uploading it.

How to create a CSV file

  • From Excel: File > Save As, then pick CSV UTF-8 (Comma delimited) (*.csv). Plain “CSV (Comma delimited)” uses your system’s legacy encoding and can mangle non-English characters.
  • From Google Sheets: File > Download > Comma-separated values (.csv). Only the current sheet is exported.
  • By hand: type rows into a text editor, separate values with commas, quote any value that contains a comma, and save with the .csv extension.

Converting CSV files

Because a CSV is the lowest common denominator, you often need it in another shape:

  • To hand it to someone who works in Excel, convert it with the CSV to Excel converter, which keeps leading zeros and long ID numbers as text and writes real date cells.
  • To feed it to code or an API, turn it into JSON with the CSV to JSON converter.
CSV to Excel ConverterConvert CSV and TSV files into styled, native Microsoft Excel (.xlsx) workbooks instantly in your browser.Convert CSV to Excel

Tools used in this guide

Free, and they run in your browser — nothing is uploaded. See every tool on the CSV & Excel Tools page.

Frequently asked questions

Is a CSV file an Excel file?

No. A CSV file is plain text that Excel can open, while an Excel workbook (.xlsx) is a compressed package of XML files. A CSV holds one table of values with no formatting, formulas or multiple sheets. Excel shows CSV files with its own icon only because it is the default program for them.

How do I open a CSV file without Excel?

Any text editor opens a CSV, because it is plain text. For a table view, use Google Sheets (File > Import), Apple Numbers, LibreOffice Calc, or a browser-based CSV viewer that reads the file locally without uploading it.

How do I create a CSV file?

In Excel, choose File > Save As and pick CSV UTF-8 (Comma delimited). In Google Sheets, choose File > Download > Comma-separated values. You can also type one in any text editor: one record per line, values separated by commas, and save it with a .csv extension.

Why does my CSV open with everything in one column?

The file uses a different separator from the one your spreadsheet expects. Many European systems write semicolons because the comma is their decimal mark. Import the file with Data > From Text/CSV in Excel and choose the delimiter, or convert it with a tool that detects the delimiter automatically.

Is a CSV file a PDF?

No. A PDF is a fixed page layout for printing and reading, while a CSV is raw tabular data meant to be imported into other software. Banks often offer both: the PDF statement to read and the CSV export to load into accounting or budgeting software.

Can a CSV file contain a virus?

A CSV cannot run code by itself, but a cell that starts with = can become a live formula when the file is opened in a spreadsheet. This is called CSV or formula injection. Be wary of opening CSV files from unknown senders and do not enable external content if Excel asks.