Plain Text MIME Type

Learn what text/plain means, how character encoding affects .txt files, and how Poly previews, searches, and reads plain text.

MIME type details for text/plain

In active use
MIME typetext/plain
Extensions
.txt
First standardized1992
Created byNathaniel Borenstein and Ned Freed
Browser supportChrome, Edge, Firefox, Opera, Safari
Example applicationsApple TextEdit, Visual Studio Code
Poly supportYes. Poly recognizes `.txt` files and readable UTF-8 content, preserving the text for useful file experiences.
Indexed by PolyYes. Poly indexes plain-text filenames and readable content for exact and meaning-based search.
Preview in PolyYes. Plain text opens in a code-friendly editor with wrapping and optional filename-based syntax highlighting.
Poly agentYes. The Poly agent can read and reason about the file's text, including requested line ranges. UTF-8 gives the most reliable results.

What does text/plain mean?

The text/plain media type identifies a linear sequence of characters with no required formatting commands, font attributes, processing instructions, or markup. Line breaks and page breaks may divide the text, but the type does not assign document structure to headings, lists, links, or tables.1

That makes text/plain deliberately broad. A grocery list, source-code sample, log, README, or configuration file can all be plain text at the byte level. More specific media types such as text/csv, text/html, or text/javascript should be used when the receiver needs the content's particular syntax and semantics.

The conventional filename extension is .txt. Plain text has no magic number. The opening bytes depend on what the text says and how its characters are encoded, so a signature cannot reliably distinguish it from source code or another textual format. RFC 5147 describes .txt as the commonly used suffix, rather than part of the media type itself.2

Renaming a document to .txt does not remove its formatting or convert its bytes. Export it as plain text from the original application, then open the result and check the characters.

A short history of text/plain

People stored character data long before MIME existed. The media type itself appeared in June 1992 in RFC 1341, the original MIME specification by Nathaniel Borenstein and Ned Freed.3 RFC 2046 replaced that document in 1996 and remains the core definition referenced by IANA.14

Later standards added narrowly scoped behavior without turning plain text into a rich document format. RFC 3676 defines optional format=flowed and delsp parameters for mail messages whose paragraphs may be rewrapped. If format is absent, fixed lines are assumed.5 RFC 5147 defines URI fragments that can identify character or line ranges in a text/plain resource.2

Which character encoding should a plain-text file use?

text/plain describes characters, but bytes still need a character encoding. In MIME, the optional charset parameter declares it:

Content-Type: text/plain; charset=utf-8

The formal default for text/plain remains US-ASCII when no charset is supplied.6 In modern files and HTTP responses, UTF-8 is usually the most interoperable choice because it represents ASCII and the full Unicode repertoire. Declaring charset=utf-8 also avoids relying on software to guess.

MIME's canonical representation uses CRLF for line breaks.1 Files stored locally commonly use LF on Unix-like systems and CRLF on Windows. Most current editors accept either, but command-line scripts, checksums, and version-control diffs can expose the difference.

If accented letters, emoji, or non-Latin scripts look corrupted, reopen the file using its original encoding before saving it as UTF-8. Saving already garbled text can make recovery harder.

How to open a TXT file

Current browsers display a response sent as text/plain, and .txt files open in ordinary text and code editors.7 Useful choices include:

  • Apple TextEdit, which can create, open, save, and convert plain-text documents.8
  • Visual Studio Code, which lets you choose an encoding and a language mode for editing.9
  • A browser when the file is available over HTTP with the correct Content-Type and charset.

A filename does not control an HTTP response. Serve raw text as text/plain, include the correct charset, and use X-Content-Type-Options: nosniff when you need browsers to honor the declared type rather than infer another one.7

Support in Poly

Poly gives plain-text files content-aware support. According to Supported File Types, Poly:

  • Opens .txt files in a code-friendly editor with line wrapping and optional filename-based syntax highlighting.
  • Indexes readable text for exact and meaning-based search.
  • Lets search results focus the relevant text range.
  • Makes the file's readable content available to the Poly agent.

Poly also recognizes readable UTF-8 content when a filename does not identify a known format. Files in an unusual legacy encoding, or binary files mislabeled as text/plain, may not preview or search as intended. Convert genuine text to UTF-8 and keep a meaningful extension when possible.

Plain text compared with nearby formats

FormatWhat it preservesBest use
Plain text (.txt)Characters and line breaksNotes, logs, portable text, simple interchange
Markdown (.md)Text plus lightweight markup conventionsReadable source that can also render as a structured document
CSV (.csv)Delimited records and fieldsTabular data exchange
HTML (.html)Structured markup interpreted by a browserWeb documents and interfaces
RTF (.rtf)Fonts, styles, and other document formattingEditable formatted documents

Plain text is often the safest export when preserving readable words matters more than layout. It cannot retain images, fonts, hyperlinks as active objects, comments, tracked changes, spreadsheet formulas, or page design.

Is text/plain safe?

Serving untrusted words as text/plain is safer than labeling them as executable script or active HTML, but plain text is not automatically harmless. RFC 5147 warns that control characters can affect terminals, bidirectional text can mislead readers, and very large lines or files can stress software.2

Inspect an unfamiliar text file in a modern editor before printing it to a terminal or feeding it to a command. Text may contain escape sequences, misleading Unicode direction controls, secrets, or instructions that another tool interprets.

The media type also does not validate the content. A file containing HTML tags remains plain text when served as text/plain; changing its header to text/html changes how a browser interprets those same bytes.

Converting to and from plain text

Choose the conversion based on what must survive:

  • From a word processor, export as .txt when only the words and line breaks matter. Formatting, images, and page layout are discarded.
  • From a spreadsheet, use CSV or tab-separated text when rows and columns matter.
  • From HTML or Markdown, use a parser or the application's export command if you want visible text without markup.
  • To create a formatted document from plain text, import it into a word processor and add structure manually. The original file contains no reliable styling instructions to restore.

Apple notes that converting a rich-text document to plain text removes its styles and saves it as .txt.8 Keep the original whenever you may need its formatting later.

Footnotes

  1. Internet Engineering Task Force. RFC 2046: Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types. Defines text/plain, the charset parameter, and canonical MIME line breaks. 2 3
  2. Internet Engineering Task Force. RFC 5147: URI Fragment Identifiers for the text/plain Media Type. Describes plain text, the conventional .txt suffix, line and character fragments, interoperability, and security considerations. 2 3
  3. Internet Engineering Task Force. RFC 1341: MIME (Multipurpose Internet Mail Extensions). The June 1992 specification introduced the text/plain subtype and names Nathaniel Borenstein and Ned Freed as authors.
  4. Internet Assigned Numbers Authority. Media Types Registry: text/plain. Lists text/plain with RFC 2046, RFC 3676, and RFC 5147 as references.
  5. Internet Engineering Task Force. RFC 3676: The Text/Plain Format and DelSp Parameters. Defines fixed and flowed text for Internet mail.
  6. Internet Engineering Task Force. RFC 6657: Update to MIME Regarding Charset Parameter Handling in Textual Media Types. Confirms that the default charset for text/plain remains US-ASCII and recommends explicit charset information.
  7. MDN Web Docs. Content-Type Header. Explains declaring media types and using X-Content-Type-Options: nosniff to prevent MIME sniffing. 2
  8. Apple Support. Create, Open, and Convert Documents in TextEdit on Mac. Documents plain-text creation, opening, conversion, and the loss of formatting when converting to .txt. 2
  9. Microsoft. Basic Editing in Visual Studio Code. Documents file editing, language modes, and file-encoding controls.
© Poly Corp. 2026