MIME Types

text/plain

The MIME type for plain text files with no formatting or markup.

What Is This?

The text/plain MIME type indicates that the content is plain, unformatted text. No markup, no styling — just raw characters. Browsers display text/plain content in a simple monospace view or download it depending on the context.

Common Uses

1

Common Use

README files and documentation

2

Common Use

Log file downloads

3

Common Use

Source code responses from APIs

4

Common Use

Fallback content type when no other type applies

Examples

Server Configuration

Serve files with the text/plain MIME type:

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

# Apache
AddType text/plain .txt
HTML Usage

Use this MIME type in HTML or HTTP:

Content-Type: text/plain

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

Related Entries

More from this reference:

Frequently Asked Questions

When should I use text/plain vs text/html?

Use text/plain for raw text that should not be rendered or formatted (logs, code output, simple data). Use text/html for web pages and formatted content that should be rendered by the browser.

Does text/plain support character encoding?

Yes. You can specify encoding with the charset parameter, e.g., Content-Type: text/plain; charset=utf-8. UTF-8 is the default.