.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.

What opens 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.

Windows

  • Notepad
  • Notepad++
  • any editor

macOS

  • TextEdit
  • any editor

Linux

  • gedit
  • nano
  • any editor

Web

  • Every browser

Open a .txt file step by step

  1. Confirm the file really is a .txt. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with Notepad or Notepad++.
  3. On Mac, use TextEdit or any editor.
  4. On Linux, try gedit or nano.
  5. Still stuck? Convert the .txt to PDF, which opens more widely.

Why can't I open my .txt file?

Almost always because no installed app understands TXT. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .txt at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

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.

What is the .txt file signature (magic bytes)?

A .txt file may start with the hex bytes EF BB BF. Those bytes are a hint rather than a guarantee, so TXT cannot be identified by its header alone.

These are the documented signatures for TXT. For a full breakdown, see the Byte order mark (UTF-8 / UTF-16) file signature page.

Documented magic-byte signatures for the .txt format
Hex signatureOffsetASCIINote
EF BB BF0-UTF-8 BOM (optional)
FF FE0-UTF-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