CSV reference

CSV format reference for reliable imports and exports

Understand records, fields, delimiters, quoting, embedded line breaks, headers, encoding, line endings, and spreadsheet safety.

11 min read Reviewed July 19, 2026 Professional reference

Document summary

A practical CSV reference for creating files that parse consistently across spreadsheets, databases, scripts, and import systems.

Key takeaways

  • CSV has common conventions but many real files use different delimiters and encodings.
  • Quote fields that contain delimiters, quotation marks, or line breaks.
  • Treat spreadsheet formula-like values as a security and data-integrity concern.
01

CSV represents rows and fields

Each record is written as a row, and fields are separated by a delimiter. Comma is common, but semicolon, tab, and pipe-delimited files are also widely encountered.

A parser should use the selected or detected delimiter consistently for the whole file.

02

Quote fields when content conflicts with structure

A field containing the delimiter, a quotation mark, or a line break should be enclosed in double quotes. A quotation mark inside a quoted field is represented by two quotation marks.

Invalid
name,note
Ava,Uses commas, sometimes
Valid
name,note
Ava,"Uses commas, sometimes"
Noah,"He said ""Hello"""
03

Headers and data types are conventions

CSV itself does not define a schema or data types. A header row is common but not guaranteed. Every field is text until the receiving application interprets it.

Document column names, null rules, date formats, decimal separators, and identifiers outside the file or in an agreed import specification.

ValuePossible interpretationRisk
00123Text identifier or numberLeading zeros can disappear
03/04/2026DateDay and month order is ambiguous
1,25Decimal in some localesComma may also be the delimiter
TRUEBoolean or textReceiving system conventions differ
04

Encoding and line endings affect portability

UTF-8 is a practical default when all systems support it. Some spreadsheet software uses or expects a byte order mark, while other workflows treat it as part of the first header.

Files may use LF or CRLF line endings. A robust parser should handle both, including line breaks inside properly quoted fields.

05

Review spreadsheet formula injection

When a CSV is opened in spreadsheet software, cells beginning with characters such as =, +, -, or @ may be interpreted as formulas. Untrusted content can become executable spreadsheet expressions.

Escape, prefix, or otherwise neutralize formula-like values according to the destination and security policy. Do not assume quoting alone prevents evaluation.

06

Use an interoperability checklist

  1. 1

    Confirm delimiter and quote rules.

  2. 2

    Confirm whether a header row exists.

  3. 3

    Use a known encoding.

  4. 4

    Define date, decimal, null, and identifier handling.

  5. 5

    Validate equal row widths.

  6. 6

    Test embedded delimiters, quotes, and line breaks.

  7. 7

    Open the export in the actual destination application.

Jump to tool

Open the CSV Viewer and inspect a sample file

Open tool