What is MIME type "application/rtf"?

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

application/rtf is the MIME type for the Rich Text Format documents.
RTF files store text along with formatting instructions. These instructions tell programs how to display fonts, colors, and styles consistently across different systems.
They are common in word processors and text editors that support rich text.
Files with this format are often referenced as RTF files.


This MIME type helps ensure that documents retain their intended look when shared or moved between applications. For more details on file handling, visit the external reference above.

Associated file extensions

Usage Examples

HTTP Header

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


    Content-Type: application/rtf    
  

HTML

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


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

Associated file extensions

FAQs

Does application/rtf work directly in web browsers?

Generally, no. Most modern web browsers (like Chrome, Firefox, and Safari) do not render RTF files natively. Instead, serving a file with the application/rtf MIME type usually triggers a download prompt or asks to open the file in an external application like Microsoft Word or WordPad.

Should I use text/rtf or application/rtf?

You should use application/rtf. While you might occasionally see text/rtf used because RTF files are technically ASCII-based, application/rtf is the canonical and standard MIME type registered with IANA. Using the standard type ensures better consistency across different web servers and clients.

How do I configure Apache to serve RTF files correctly?

To ensure Apache serves .rtf files with the correct MIME type, add the following line to your .htaccess file or main configuration: AddType application/rtf .rtf. This prevents the server from sending them as generic text or binary streams.

Are there security risks associated with application/rtf?

Yes, RTF files can be exploited. Although they are text-based, they can contain embedded objects (OLE) or malicious code that exploits vulnerabilities in word processors. Always validate and scan user-uploaded RTF files before processing or serving them.

How can I force an RTF file download in PHP?

You can force a browser to download the file rather than attempting to display it by setting the correct headers. Use header('Content-Type: application/rtf'); combined with header('Content-Disposition: attachment; filename="document.rtf"'); in your PHP script.

Why is my RTF file displaying as raw code in the browser?

This usually happens if the server sends the file as text/plain instead of application/rtf. The browser renders the raw RTF markup (braces and control words) as text. Check your server's MIME type configuration to ensure the .rtf extension maps to the correct type.

How do I add RTF support to Nginx?

Open your mime.types file (usually located in /etc/nginx/) and ensure the line application/rtf rtf; exists. If it is missing, add it inside the types { } block and reload Nginx to apply the changes.

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.