ZERO-UPLOAD SANDBOX
.csv .tsv Tier 1 · Deep AST Parser

Comma-Separated Values (RFC 4180)

Plain-text tabular interchange format notorious for real-world parser edge cases: optional UTF-8 BOMs (`EF BB BF`), multiline quoted cells, doubled quote escapes (`""`), and formula injection.

RFC 4180 permits embedded CRLF line breaks inside double-quoted fields—naive `text.split('\n')` parsers corrupt row counts whenever user comments span multiple lines.

MIME Types text/csv, application/csv
Byte Endianness text
Container Family text
PRONOM PUID x-fmt/18
0xFF

Drop any .csv file (even 100 GB+) to inspect locally

Reads tiny File.slice() header/footer pages in a sandboxed Web Worker · 0 Bytes Uploaded

Binary Signature & Wire Layout

.csv Magic Bytes & Header Offset Map

Note: CSV does not rely on a fixed static magic byte sequence at offset 0x00; parsers validate structural framing defined below.
Byte Offset Length Data Type Field Name Engineering Description
0x00 (opt) 0 or 3 B uint8[3] utf8_bom Optional Excel UTF-8 BOM (EF BB BF)
Row 1 var utf8 header_record Comma-delimited column names terminated by LF or CRLF
Upload Gateway & AppSec Advisory

.csv Security & Polyglot Risk Matrix

Risk Level: medium
Arbitrary Code / Macros
NO (Inert Data)
Pickle Deserialization
SAFE (No Pickle VM)
XML External Entity (XXE)
NONE
Polyglot Prepend Risk
LOW (Strict 0x00 Magic)
Backend Upload Validation Recommendation

Guard against CSV Formula Injection (DDE): sanitize or prefix cells starting with '=', '+', '-', or '@' when exporting user-uploaded CSVs back to Excel/Sheets.

Compiler-Verified Reference Code

Read .csv Header & Metadata Without Heavy Dependencies

import csv, sys
with open(sys.argv[1], "r", encoding="utf-8-sig", newline="") as f:
    reader = csv.reader(f)
    headers = next(reader)
    print(f"CSV columns ({len(headers)}): {headers}")
CI/CD & Unit Test Fixtures

Deterministic .csv Sample Files & Edge Cases

Open Full .csv Sample Matrix & Mutator →
minimalexpect: valid

minimal-rfc4180.csv

Clean 2-row comma-separated table with LF line endings and no BOM.

↓ Download (89 B)
SHA-256: 05718c2daf0ae301a68f435f20cbb9feb8f079fae27efc908a41c41a86daba62
Exact: 89 bytes
curl -fsSL https://fileformat.co/fixtures/v1/csv/minimal-rfc4180.csv -o minimal-rfc4180.csv \
  && echo "05718c2daf0ae301a68f435f20cbb9feb8f079fae27efc908a41c41a86daba62  minimal-rfc4180.csv" | shasum -a 256 -c
realisticexpect: valid

orders-unicode-quoted.csv

Realistic UTF-8 CSV containing quoted commas, whitespace padding, and Japanese characters.

↓ Download (230 B)
SHA-256: 8dcc3d4302a7e62ad485797bc492f9d5217e8a919469109eed8af219eb4e1354
Exact: 230 bytes
curl -fsSL https://fileformat.co/fixtures/v1/csv/orders-unicode-quoted.csv -o orders-unicode-quoted.csv \
  && echo "8dcc3d4302a7e62ad485797bc492f9d5217e8a919469109eed8af219eb4e1354  orders-unicode-quoted.csv" | shasum -a 256 -c
edge-caseUTF-8 BOM + Multiline Quotesexpect: valid

utf8-bom-multiline-escaped.csv

Classic parser breaker: starts with `EF BB BF` BOM, uses `\r\n` inside quoted cells, doubled `""` escapes, and ZWJ emoji.

↓ Download (158 B)
SHA-256: 1550b6c3787e1ad84d709a50341f88dbd2b5ae5a96e5e620e3459a82d0392a5f
Exact: 158 bytes
curl -fsSL https://fileformat.co/fixtures/v1/csv/utf8-bom-multiline-escaped.csv -o utf8-bom-multiline-escaped.csv \
  && echo "1550b6c3787e1ad84d709a50341f88dbd2b5ae5a96e5e620e3459a82d0392a5f  utf8-bom-multiline-escaped.csv" | shasum -a 256 -c

Related Specifications & Alternatives