.txt

What is a .txt file?

Plain Text File · Document · Universal · 1960s

TXT is the simplest possible document: plain, unformatted text with no fonts, colours or layout. It opens instantly in any text editor on any system, which makes it perfect for notes, logs and readme files.

Category
Document
MIME type
Type
Plain text
Is a .txt file safe to open? Completely safe. A plain text file cannot execute anything on its own.

What is a .txt file used for?

A .txt file is just characters, with no styling information at all. That simplicity is its strength: nothing can break the layout because there is no layout to break.

It is ideal for notes, configuration snippets, logs and anything you want to stay readable for decades.

The main subtlety is text encoding. Most files today use UTF-8, which handles every language, but very old files may use other encodings.

How to open a .txt file

The .txt format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .txt file.

Windows

  • Notepad
  • Notepad++
  • any editor

macOS

  • TextEdit
  • any editor

Linux

  • gedit
  • nano
  • any editor

Web

  • Every browser

How to convert a .txt file

You can convert a .txt file to PDF, DOCX, MD using a conversion tool or the export menu of an app that opens it.

.txt file signature (magic bytes)

Programs recognise a .txt file by the bytes at the start of the file, not by its name. These are the signatures for TXT.

Hex signatureOffsetNote
EF BB BF0UTF-8 BOM (optional)
FF FE0UTF-16 LE BOM (optional)

See the full magic-numbers reference for every format.

Frequently asked questions

What is a .txt file?

TXT is the simplest possible document: plain, unformatted text with no fonts, colours or layout. It opens instantly in any text editor on any system, which makes it perfect for notes, logs and readme files.

Why does my TXT file show strange characters?

It was likely saved in a different text encoding. Reopen it and choose UTF-8, or the encoding it was created with.

Related formats