What is MIME type "application/x-csv"?

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

The MIME type application/x-csv defines a file that holds plain text data with values separated by commas.
It informs systems and applications how to process the file.
While the standard MIME type is text/csv, some systems use application/x-csv for legacy support or specific compatibility reasons.
Files with this MIME type typically use the CSV format. For more technical details on MIME types, see resources like IANA.

Associated file extensions

Usage Examples

HTTP Header

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


    Content-Type: application/x-csv    
  

HTML

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


    <a href="file.dat" type="application/x-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/x-csv');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

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

No, the official IANA standard for CSV files is text/csv. The application/x-csv type is considered a non-standard or legacy definition, often used by older operating systems or specific software implementations before RFC 4180 was standardized.

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

To force this specific MIME type, add the directive AddType application/x-csv .csv to your .htaccess file or main configuration. However, unless you are supporting legacy software that explicitly requires the x- prefix, it is recommended to use the standard text/csv.

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

Browsers typically treat types starting with application/ as binary data requiring a download, whereas text/ types may render in the browser window. Additionally, if the server sends a Content-Disposition: attachment header, the browser will force the file to save to disk regardless of the MIME type.

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

text/csv is the modern, registered standard, while application/x-csv is an experimental or vendor-specific variant. Functionally, the file content is identical (comma-separated values), but strictly typed APIs or firewalls might reject the non-standard application/x-csv if they are configured to only accept IANA-compliant types.

How do I handle application/x-csv in Nginx?

You can define the mapping in your nginx.conf or external mime.types file. Add the line application/x-csv csv; inside the types { ... } block. Always reload the Nginx service after modifying configuration files to ensure the changes take effect.

Are there security risks associated with application/x-csv files?

Yes, primarily via CSV Injection (or Formula Injection). If a CSV file containing cells starting with =, +, -, or @ is opened in a spreadsheet program like Excel, the software may execute them as formulas. Always validate and sanitize input when generating CSV files for user download.

Should I use application/x-csv for Excel exports?

Generally, no; text/csv or application/vnd.ms-excel are preferred for Excel interaction. However, some legacy web applications historically used application/x-csv to ensure older versions of Internet Explorer handed the file off to Excel correctly instead of displaying raw text.

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.