What is MIME type "image/ascii-art"?

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

image/ascii-art is a MIME type used for representing images made with text. These files store pictures created by arranging characters in a deliberate pattern. They do not contain graphic data like pixels but instead rely on plain text display.

Files with TXT, ASC, or ASCII content are commonly associated with this type.

Key purposes and uses:
This MIME type is ideal for simple art applications and digital documents where graphics software is unnecessary. For more information, visit Wikipedia on ASCII art.

Associated file extensions

Usage Examples

HTTP Header

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


    Content-Type: image/ascii-art    
  

HTML

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


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

Associated file extensions

FAQs

Is image/ascii-art a standard IANA MIME type?

No, image/ascii-art is not a registered IANA media type; it is a non-standard or experimental label used to semantically distinguish art from regular text. For maximum compatibility across the web, most developers prefer using text/plain or creating a custom text/vnd.ascii-art type to ensure browsers handle the .txt content safely.

How do I configure Apache to serve .asc files as image/ascii-art?

You can add a directive to your .htaccess file or main configuration to map the extension. Use the line AddType image/ascii-art .asc to explicitly tell the server to send this MIME type. However, ensure the client application knows how to handle this type, or it may force a file download instead of displaying the content.

Why does my ASCII art look distorted in the browser?

ASCII art requires a monospaced font (fixed-width font like Courier or Consolas) to maintain the alignment of characters. If the browser or text editor uses a proportional font (like Arial), the image will appear scrambled. When embedding this content in HTML, always wrap it in <pre> tags or apply CSS font-family: monospace.

Will web browsers render image/ascii-art automatically?

Most browsers do not natively recognize image/ascii-art as an image format and may default to downloading the file. To ensure the art displays directly in the browser window, it is safer to serve the file as text/plain or embed the text within an HTML page. If you must use this specific MIME type, users may need to configure their browser to open it with a text viewer.

Are there security risks associated with ASCII art files?

Generally, these files are safe because they contain only plain text, but servers must be configured correctly to prevent Cross-Site Scripting (XSS). If a browser incorrectly interprets the file as HTML, malicious scripts could execute. Always send the X-Content-Type-Options: nosniff header to force the browser to respect the declared MIME type.

What is the difference between image/ascii-art and text/plain?

Functionally, the binary content is identical, but image/ascii-art provides semantic context indicating the file is a visual representation. While text/plain is a catch-all for any text, using a specific type like image/ascii-art helps specific applications or scripts identify and treat .asc files as graphics rather than documentation.

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.