CSV Format Guide

Master CSV format, RFC 4180 standards, and best practices

πŸ“… Updated February 2026⏱️ 7 min read

What is CSV?

CSV (Comma-Separated Values) is a simple text format for storing tabular data. Each line represents a data record, and each record consists of fields separated by delimiters (typically commas). First standardized in RFC 4180 in 2005, CSV remains one of the most universal data exchange formats.

Despite its simplicity, CSV handles billions of data transfers dailyβ€”from database exports to spreadsheet imports to API data exchange.

Basic CSV Structure

id,name,email,age,active
1,Alice Johnson,alice@example.com,30,true
2,Bob Smith,bob@example.com,25,false
3,Carol White,carol@example.com,35,true

Header Row

First line contains column names (optional but recommended)

Data Rows

Each subsequent line is a data record with same number of fields

RFC 4180 Standards

RFC 4180 defines the official CSV specification. Key rules include:

1. Line Breaks

Records separated by line breaks (CRLF or LF). Last record may or may not have ending line break.

2. Header Row (Optional)

First line may be a header with same format as normal records. Header field names should not contain line breaks or special characters.

3. Fields & Delimiters

Fields separated by commas. Each record must have same number of fields.

field1,field2,field3

4. Quoting Rules

Fields containing commas, line breaks, or double quotes must be enclosed in double quotes.

1,"Johnson, Alice","Says ""Hello"" to world",true

5. Escaping Quotes

Double quotes within quoted fields must be escaped by doubling them.

"He said ""Hello"" to me" β†’ He said "Hello" to me

Delimiter Variations

While "CSV" means comma-separated, many systems use alternative delimiters:

FormatDelimiterUse Case
CSV, (comma)Standard US/UK format
SSV; (semicolon)European Excel, avoids comma conflicts
TSV\t (tab)Better visual separation, rare in text
PSV| (pipe)Log files, database exports
Learn more about choosing the right delimiter β†’

Character Encoding

Encoding issues are a common source of CSV problems, especially with international characters.

⚠️ Common Issues

  • Excel opening UTF-8 files with garbled characters
  • Accented characters (Γ©, Γ±, ΓΌ) displaying incorrectly
  • Asian characters (δΈ­ζ–‡, ζ—₯本θͺž) corrupted
  • Emoji rendering as question marks

Encoding Best Practices

  • UTF-8: Default choice for modern systems, supports all Unicode characters
  • UTF-8 with BOM: Add byte order mark for Excel compatibility
  • ISO-8859-1 (Latin-1): Legacy encoding for Western European languages
  • Specify Encoding: Always document the encoding used

Handling Edge Cases

Empty Fields

1,Alice,,true     β†’ age field is empty 2,,bob@email.com,  β†’ name empty, active empty

Empty fields represented by adjacent delimiters

Line Breaks in Fields

1,Alice,"123 Main St
Apt 4B
New York, NY",true

Multi-line fields must be quoted

Leading/Trailing Spaces

1, Alice ,bob@email.com, true

RFC 4180: Spaces outside quotes preserved. Some parsers trim automatically.

CSV vs JSON

FeatureCSVJSON
StructureFlat, tabularHierarchical, nested
Data TypesAll stringsString, number, boolean, null
File SizeSmallerLarger (verbose)
Human ReadableVery readableReadable with formatting
Excel CompatibleNative supportRequires conversion
API StandardRareDe facto standard

πŸ’‘ Need to Convert?

Our tool handles all CSV edge cases: custom delimiters, UTF-8 encoding, proper quoting, and validation.

Try CSV Converter β†’

Convert CSV Files

Free CSV to JSON/Excel converter with validation

Start Converting β†’

Authored by: JSON CSV Converter

Last updated: February 19, 2026