BuildUtilities

CSV Format Guide

What is CSV?

CSV (Comma-Separated Values) is a plain-text format for storing tabular data. Each line represents a row, and values within a row are separated by commas. Despite its simplicity, CSV is one of the most widely used formats for data exchange between spreadsheets, databases, and applications.

Basic Format

name,email,age
Alice,alice@example.com,30
Bob,bob@example.com,25
"Carol, Jr.",carol@example.com,28

The first row is typically the header. Values containing commas, quotes, or newlines must be enclosed in double quotes.

Quoting Rules

  • Wrap values in double quotes if they contain commas, newlines, or double quotes
  • Escape double quotes by doubling them: "She said ""hello"""
  • Leading/trailing whitespace inside quotes is preserved

Common Delimiters

  • Comma (,): standard CSV
  • Tab (\t): TSV files, common in exports
  • Semicolon (;): used in European locales where comma is the decimal separator
  • Pipe (|): used when data contains many commas

Common Mistakes

  • Not quoting values with commas: breaks column alignment entirely
  • Encoding issues: always use UTF-8. Add a BOM (byte order mark) for Excel compatibility.
  • Inconsistent column counts: every row must have the same number of fields
  • Trailing newline: some parsers create an empty row from a trailing newline

Convert and format CSV data with our CSV to JSON, JSON to CSV, and CSV Formatter tools.

FAQ

CSV vs JSON, which should I use?

CSV is best for flat, tabular data and spreadsheet compatibility. JSON is better for nested, hierarchical data and API responses.

How do I handle special characters in CSV?

Enclose the field in double quotes. To include a literal double quote, escape it by doubling: "".

Try These Tools

Related Documentation

Tip Jar