TXT File Format Explained

Plain Text · .txt

Extension.txt
MIME typetext/plain
TypeText
Developed by—
First released—
Royalty-freeYes
CompressionNone

What is a TXT file?

A TXT file contains nothing but characters: no fonts, sizes, colours, images or page layout. That is its whole point. Notes, logs, configuration, source code, subtitles and data exports use plain text because every program on every system can read it and because it stays readable for decades.

Two details are not stored in the file and must be guessed by the reading program: the character encoding (UTF-8 today, older code pages in legacy files) and the line-ending convention (LF on Linux and macOS, CR LF on Windows). Wrong guesses show up as odd symbols or as text on a single line.

When TXT is the right choice

Strengths

  • Opens everywhere, from a phone to a server console
  • Tiny files, easy to search, compare and process with scripts
  • No hidden content: what you see is the entire file

Limitations

  • No formatting at all: no bold, headings, tables or images
  • Encoding and line endings can differ between systems
  • Long documents are hard to navigate without structure

How to open a TXT file

Notepad, TextEdit, any code editor or a browser tab opens TXT. If accented or non-Latin characters look wrong, the editor picked the wrong encoding; most editors let you reopen the file as UTF-8 or another code page.

How to convert a TXT file

To add headings, fonts and tables, convert to a word-processor format: TXT to DOCX for Word, TXT to ODT for LibreOffice or TXT to RTF for older editors. In the other direction, DOCX to TXT strips a Word file down to its text, and OCR PDF to TXT reads text out of a scan.

Frequently Asked Questions

Why does my TXT file show strange characters?

The file was saved in one encoding and opened in another. Reopen it and choose UTF-8, or the code page of the original system (Windows-1252 for Western European Windows, Windows-1251 for Cyrillic), then save as UTF-8.

Why is the whole file on one line in Notepad?

The file uses Unix line endings (LF) and an old Notepad version only recognizes Windows ones (CR LF). Current Notepad, WordPad or any code editor displays it correctly.

Is TXT the same as RTF or Markdown?

All three are text you can open in an editor, but RTF carries formatting codes and Markdown uses punctuation for structure. A plain TXT file has neither.

Can a TXT file contain a virus?

A genuine text file cannot execute anything. Be cautious only if the file is actually a script or an executable renamed with a .txt extension; the File Format Identifier tool shows what a file really is.