What is MIME type "application/csv"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

application/csv is a MIME type for files that hold Comma-Separated Values data. These files store tabular data in plain text. Values are separated by commas, making the format simple and human-readable.

When a file with a CSV extension is sent over the web, this MIME type tells software to treat the file as structured data. It ensures programs know they are handling rows and columns of data.


This MIME type is most useful when a quick, light, and cross-platform way to handle tabular information is needed. For more detailed information on handling CSV files, refer to trusted online resources.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: application/csv    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="application/csv">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'application/csv');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

Is application/csv the standard MIME type for CSV files?

No, the official IANA standard registered in RFC 4180 is text/csv. However, application/csv is a common legacy type still widely used to force file downloads or support older applications that do not recognize the text-based definition.

Why does my browser download the CSV file instead of displaying it?

Browsers generally treat application/* MIME types as binary data or external applications, triggering a download prompt. If you want the CSV data to display directly in the browser window (inline), you should use text/csv instead.

How do I configure Apache to serve files as application/csv?

You can add the AddType directive to your server configuration or .htaccess file. Add the line AddType application/csv .csv to map the extension. Ensure this does not conflict with existing definitions for the standard text/csv type.

Which MIME types should I accept for CSV file uploads?

Because client behavior varies, you should validate against a list of common CSV types. Allow text/csv, application/csv, text/x-csv, application/x-csv, and sometimes application/vnd.ms-excel to ensure users on different operating systems can upload their csv files successfully.

Are there security risks associated with application/csv?

While CSV files are plain text and cannot contain standard malware, they are vulnerable to CSV Injection (Formula Injection). If a cell starts with =, @, +, or -, spreadsheet software like Excel may execute it as a malicious formula when the user opens the file.

What is the difference between text/csv and application/csv?

text/csv implies the content is human-readable and follows the RFC 4180 standard. application/csv implies the file is intended for processing by an application (like a spreadsheet program) and often signals to the browser that the file should be saved rather than rendered.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.