THE FILE FIELD GUIDE
.txt

Text File

Documents

A common suffix for unformatted text. It does not identify character encoding; misreading UTF-8, UTF-16 or legacy encodings can cause garbling.

What it is used for
Plain-text notes, logs and data
What the file contains
Text
All sections, questions and sources

Content reviewed: · Editor:Kai

First: choose for your purpose

TXT stores text but does not identify UTF-8 versus Shift_JIS by its suffix. Saving garbled text can lose data. Separate choosing the opening encoding from converting to another encoding.

Before saving garbled text

Before saving garbled text
Situation / goalNext actionWhat to check
Japanese characters are garbledClose without saving and reopen using the original encoding.Check names, symbols and the final line.
Replacement characters were savedCompare with the original attachment or backup; resaving as UTF-8 cannot restore lost characters.Determine whether the original already contains replacements.
A long line or unexpected wrappingDistinguish visual wrapping from newline characters.Avoid inserting real line breaks when wrapping alone is sufficient.

Source for these steps:Apple · If characters aren’t displayed correctly in TextEdit

Opening steps

Choose your environment or purpose to see its steps.

Windows: read first in Notepad

A built-in editor can inspect small text files.

  1. Open a copy in Notepad and inspect Japanese characters and line endings.
  2. Close without saving if garbled, ask for the encoding and reopen with an editor supporting explicit encoding selection.
  3. Save a correctly decoded copy under a new name and verify its encoding and TXT suffix.
macOS: select the opening encoding

Use TextEdit opening options when automatic detection fails.

  1. Select the file in TextEdit’s File → Open; use Show Options when characters are garbled.
  2. Choose the producer’s encoding in Plain Text Encoding and compare the result.
  3. Confirm plain-text mode before saving and retain the original separately.
Mobile / large files: choose by purpose

A preview may omit part of a large log.

  1. Save locally and inspect characters and the final line in a TXT viewer.
  2. Use a large-file desktop editor if loading stalls; distinguish visual wrapping from real line breaks.
  3. Copy only the required range and inspect personal data before sharing account details or logs.

Menu labels and support vary by app, OS and version. Preserve the original before making changes.

Compare the same text in two encodings

These original practice files contain the same short Japanese text in UTF-8 and UTF-16LE. Try the editor’s encoding selection before changing your own document.

The expected first line is “拡張子ナビの練習ファイルです。” Save a separate copy and reopen it to distinguish decoding from choosing a new output encoding.

The bytes and decoding to identical text are checked; rendering in every editor is not guaranteed.

Source for these steps:Apple · If characters aren’t displayed correctly in TextEdit

Troubleshooting by symptom

  • Replacement characters can indicate wrong decoding or prior damage. Obtain an original copy and confirm encoding.
  • Distinguish newline conventions from visual wrapping. Use an editor suitable for large logs.
  • Long line: enable visual wrapping. Inserting actual line breaks can change configuration/data meaning.
  • Saved as RTF: check rich-text mode; save as plain text and verify the visible extension.
  • Different symbols on another PC: compare encoding, font, line endings and tab width using a copy.

Convert a TXT encoding to UTF-8

  1. First decode with the correct original encoding.
  2. Save a new UTF-8 copy, reopen and verify non-ASCII text.
  3. Reopen the output and check Japanese characters, symbols, paragraphs and the final line.

Saving incorrectly decoded text can destroy characters. Rich-document-to-TXT conversion loses formatting/images.

Decoding versus encoding conversion

Choosing an opening encoding controls how bytes are decoded. Saving wrongly decoded text as UTF-8 does not restore the original characters.

Once correctly decoded, save a new copy in the recipient’s encoding and reopen it to check names, symbols and the final line.

Source for these steps:Apple · If characters aren’t displayed correctly in TextEdit

What plain text preserves

TXT cannot preserve fonts, colors, images or columns. Apparent tables may be plain characters separated by spaces/tabs.

In configuration or machine-read text, spaces, line breaks and quotes can be significant. Keep readability edits separate from changing operational data.

Related-format differences

Related-format differences
Format / choicePurpose and preserved information
TXTText with separately determined encoding/line endings.
RTFFormatted text; converting to TXT removes styling.
CSV / MDOther text-based formats whose delimiters/syntax have additional meaning.

Handling and security

Viewing text differs from executing its contents. Do not paste untrusted commands into a terminal.

Questions and answers

Is every TXT UTF-8?

No. The suffix does not guarantee encoding.

What if I saved garbled text?

You may need the original or a backup; keep a copy before editing.

Can plain TXT embed a photo?

Plain text has no embedded-image/document-formatting structure; use a document format.

Will saving as UTF-8 fix garbled text?

Decode with the correct encoding first; resaving incorrect characters does not restore them.

Does visual wrapping add line breaks?

Normally it changes display only; distinguish it from inserting newline characters.

Format facts: name, steward and MIME type
Formal name
Plain text
Steward / specification
No single extension owner; MIME defined by IETF
MIME type
text/plain

Primary and official sources