How to Create a TXT File on Any Device or Operating System

Plain text files are one of the most universal file formats in computing. No special software required, no proprietary format to decode — a .txt file works across virtually every operating system, device, and application. Whether you're storing notes, writing a script, creating a configuration file, or preparing data for import, knowing how to create a TXT file is a genuinely useful skill.

What Is a TXT File?

A TXT file (plain text file) stores unformatted text encoded in a standard character set — most commonly UTF-8 or ASCII. Unlike .docx or .rtf files, TXT files carry no embedded formatting instructions, fonts, or styles. What you type is exactly what gets stored.

This simplicity is what makes them so portable. A TXT file created on Windows in 1995 can be opened on a modern Mac, Linux server, or smartphone without conversion.

How to Create a TXT File on Windows

Using Notepad

Notepad is the built-in plain text editor on every version of Windows.

  1. Press Windows + S, type Notepad, and open it
  2. Type your content
  3. Go to File → Save As
  4. Choose your folder, name your file, and make sure the Save as type dropdown is set to Text Documents (*.txt)
  5. Click Save

One important detail: Notepad offers encoding options at the bottom of the Save As dialog — UTF-8, UTF-16, and ANSI. For most modern use cases, UTF-8 is the right choice. It handles international characters and is the web standard.

Using the Command Prompt

You can create an empty TXT file instantly from the command line:

type nul > filename.txt 

Or create one with content:

echo Your text here > filename.txt 

This is useful for automation, scripting, or when working on a server without a GUI.

Using Right-Click in File Explorer

In most Windows versions: right-click in a folder → New → Text Document. This drops a blank TXT file directly into that location, ready to rename and open.

How to Create a TXT File on macOS 🖥️

Using TextEdit (with a catch)

macOS ships with TextEdit, but it defaults to Rich Text Format (RTF) — not plain text. To create a genuine TXT file:

  1. Open TextEdit
  2. Go to Format → Make Plain Text (or press Shift + Command + T)
  3. Type your content
  4. Save with Command + S — the file will save as .txt

If you skip the plain text step, TextEdit will save an .rtf file even if you manually type .txt in the filename. The format toggle matters.

Using Terminal

touch filename.txt 

This creates an empty TXT file in your current directory. To create one with content:

echo "Your text here" > filename.txt 

How to Create a TXT File on Linux

Linux users typically use terminal commands or lightweight editors:

  • Terminal:touch filename.txt or nano filename.txt (opens an editor inline)
  • Gedit, Kate, or Mousepad — GUI text editors available on most desktop distributions
  • Any of these will save as plain text by default — no format switching needed

nano is particularly useful on servers or remote machines accessed via SSH, where no graphical interface is available.

How to Create a TXT File on Mobile Devices 📱

Android

Android doesn't include a dedicated plain text editor by default, but several free apps handle this cleanly — search for "text editor" or "plain text editor" in the Google Play Store. Many file manager apps also allow you to create a new .txt file directly from within a folder.

iPhone / iPad

iOS is more restrictive about direct file creation. Options include:

  • Files app — some third-party integrations allow TXT creation
  • Dedicated apps like Textastic, Editorial, or plain text note apps that export to .txt
  • Saving a note from the Notes app doesn't produce a TXT file by default — you'd need to share/export it differently

The experience varies based on which apps you have installed and how your iCloud or local storage is configured.

Key Variables That Affect Your Approach

FactorHow It Affects the Process
Operating systemBuilt-in tools and default behaviors differ significantly
Encoding needsUTF-8 vs ASCII matters for special characters or international text
File destinationLocal storage, cloud sync, or a server each has different workflows
Use caseConfig files, scripts, and data exports may need specific line endings (CRLF vs LF)
Technical skillGUI editors vs command-line tools suit different comfort levels

Line Endings: A Detail That Quietly Matters

One variable that catches people off guard is line endings. Windows uses CRLF (carriage return + line feed), while macOS and Linux use LF only. For most personal notes, this is invisible. But if you're creating a TXT file that will be read by a program, shell script, or server, mismatched line endings can cause unexpected behavior.

Editors like VS Code, Notepad++, and nano all let you explicitly control which line ending format is used — something basic editors like Notepad don't surface as clearly.

When Plain Text Isn't Enough

TXT files have no support for formatting, tables, images, or structured data beyond raw characters. If your needs involve any of those, you're likely better served by Markdown (.md), CSV (.csv), or a document format. But for raw notes, logs, configuration, and lightweight data exchange, plain text remains one of the most reliable and future-proof formats in existence.

The right method for creating a TXT file depends on which operating system you're working on, what the file will be used for, and how it fits into the rest of your workflow — all of which are specific to your setup.