Media type · text/plain

text/plain

text/plain is unformatted text: no markup, no structure, just characters and line breaks.

Key facts

Typetext/plain
Extensions.txt
StandardRFC 2046; IANA registry
Text or binaryText
Browser behaviorDisplays inline as text

What text/plain is

It is the fallback for readable text that is not HTML, JSON, CSS or another structured format. Browsers display it verbatim, preserving characters and line breaks. It is a good choice for logs, README files offered as downloads and simple API errors aimed at humans.

When not to use it

Do not use it for machine-readable payloads: JSON, CSV and XML have their own types, and clients use the type to choose a parser. Do not use it for HTML, either — a browser will show the tags. For a text format with an unknown charset, the charset parameter prevents the client from guessing.

Frequently asked questions

Can text/plain include a charset?

Yes. charset=utf-8 is common and recommended for non-ASCII text; without it the client may fall back to a locale default.

Is text/plain safe for user-supplied content?

It is safer than HTML because browsers do not parse markup, but content sniffing can still cause surprises. Send X-Content-Type-Options: nosniff to prevent the browser from reinterpreting it.

New tools, straight to your inbox

One short email when we add tools worth using. No spam, unsubscribe anytime.