Skip to main content

text/csv

text

The MIME type for Comma-Separated Values files, defined by RFC 4180. Use with Content-Disposition: attachment;filename="data.csv" to trigger a download. Include charset=utf-8 for Unicode data. Excel requires a UTF-8 BOM (0xEF 0xBB 0xBF) at the start of the file to correctly detect UTF-8 encoding.

Details

text/csv is defined by RFC 4180 and registered with IANA. It is the standard type for CSV file downloads and data exports.

Content-Disposition: almost always paired with Content-Disposition: attachment;filename="export.csv" to trigger browser download.

Charset and BOM: - Always include charset=utf-8 in Content-Type - Excel (Windows) requires a UTF-8 BOM: \xEF\xBB\xBF as the first 3 bytes - Without BOM, Excel may open UTF-8 CSVs incorrectly in Western locales

Dialect: RFC 4180 defines CRLF line endings. Real-world CSVs vary. Most parsers handle LF-only.

Parameters

ParameterDescription
charsetAlways specify utf-8 for Unicode data. Excel adds BOM (0xEF 0xBB 0xBF) for UTF-8 recognition.

Common use

Data export endpoints, report downloads, spreadsheet generation

See Also