MIME Types

text/csv

The MIME type for Comma-Separated Values data files.

What Is This?

The text/csv MIME type indicates that the content is a Comma-Separated Values (CSV) file. CSV is a simple tabular data format where each line represents a row and commas separate columns. It is widely used for data export, import between spreadsheet applications, and data interchange with legacy systems.

Common Uses

1

Common Use

Data export from databases and analytics platforms

2

Common Use

Spreadsheet import/export (Excel, Google Sheets)

3

Common Use

Large dataset downloads for data analysis

4

Common Use

Bank statements and financial data exports

Examples

Server Configuration

Serve files with the text/csv MIME type:

# Nginx
location ~ \.csv$ {
  add_header Content-Type "text/csv";
}

# Apache
AddType text/csv .csv
HTML Usage

Use this MIME type in HTML or HTTP:

Content-Type: text/csv

<!-- HTML reference -->
<link rel="preload" href="file.csv" as="fetch" crossorigin>

Related Entries

More from this reference:

Frequently Asked Questions

Should I include a BOM in CSV files?

Including a UTF-8 BOM (byte order mark) at the start of CSV files helps Excel correctly interpret UTF-8 encoding, especially when the file contains non-ASCII characters. Without the BOM, Excel may display characters incorrectly.

How do I handle commas within CSV fields?

Enclose fields containing commas, newlines, or double quotes in double quotes. Use two double quotes inside a quoted field to represent a literal double quote character. This is defined in RFC 4180.