Text lives in many kinds of files. Some are plain text with conventions on top; others are structured packages or page descriptions. Knowing which is which explains why some files open anywhere and others need specific software.
Plain-text formats
These can be opened in any text editor.
| Extension | Contains | Typical use |
|---|---|---|
| .txt | Unstructured text | Notes, logs, simple exports |
| .csv / .tsv | Rows of values separated by commas or tabs | Spreadsheet and database exchange |
| .md | Text with Markdown formatting marks | Documentation, README files, notes |
| .html | Text with HTML tags | Web pages, email bodies |
| .json | Structured data: objects, arrays, strings, numbers | APIs, configuration |
| .xml | Structured data in nested tags | Feeds, configuration, document standards |
| .srt / .vtt | Numbered, timed caption blocks | Subtitles |
Plain text is the most durable format: it has no required software, works with version control, and can be searched and processed by simple tools. Its main weaknesses are ambiguity about encoding and line endings, and the lack of built-in formatting.
CSV deserves a note: the common specification (RFC 4180) quotes fields that contain commas, quotes or line breaks, but many programs deviate from it. Delimiters, quoting and encoding vary, which is why CSV imports so often go wrong.
Rich-text and word-processor formats
| Extension | Contains |
|---|---|
| .rtf | Plain text with formatting control words ({\b bold}); readable but cluttered |
| .docx | A ZIP archive of XML files (Office Open XML): text, styles, images, metadata |
| .odt | A ZIP archive of XML files (OpenDocument), used by LibreOffice |
| .epub | A ZIP archive of XHTML pages, CSS and images, for e-books |
Rename a .docx to .zip and open it, and you will find word/document.xml holding the text. That structure preserves formatting, comments and tracked changes, but you need an application that understands it.
A PDF describes how pages look: it places glyphs at positions on fixed-size pages. It does not necessarily store text in reading order, or store paragraphs at all. That is why copying from a PDF produces broken lines, hyphenated fragments and occasionally scrambled order or missing spaces, and why scanned PDFs contain no text unless OCR has been applied. See how to clean pasted text.
Choosing a format
- For text that must last and be processed by tools: .txt, .md or .csv in UTF-8.
- For documents others will edit with formatting: .docx or .odt.
- For fixed-layout distribution and printing: .pdf.
- For the web: .html.