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
Common Use
README files and documentation
Common Use
Log file downloads
Common Use
Source code responses from APIs
Common Use
Fallback content type when no other type applies
Examples
Serve files with the text/plain MIME type:
# Nginx
location ~ \.txt$ {
add_header Content-Type "text/plain";
}
# Apache
AddType text/plain .txtUse 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:
text/html
The MIME type for HTML documents, the standard markup language for web pages.
text/css
The MIME type for Cascading Style Sheets used to style HTML documents.
text/javascript
The MIME type for JavaScript source files used to add interactivity to web pages.
text/csv
The MIME type for Comma-Separated Values data files.
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.