What a text file is and why you might need one

A text file is a document that contains only plain text — no formatting, no images, no hidden code. It has a .txt extension, like "notes.txt" or "shopping-list.txt". Text files open in any program on any device, which makes them useful for quick notes, lists, code snippets, configuration settings, or anything you want to store in the simplest possible format.

You might create a text file to jot down a password hint, keep a to-do list, save a recipe, or store data in a format that won't get corrupted by software updates. Because text files are so basic, they're also one of the safest ways to store information — they can't carry viruses or malware the way a Word document or executable file can.

Key Takeaways

  • On Windows, right-click in a folder, choose New, then Text Document, and name the file with a .txt extension.
  • On Mac, open TextEdit, go to Format menu and select Plain Text, then save the file with a .txt extension.
  • On Linux, open a terminal and use the command touch filename.txt or open a text editor like gedit or nano.
  • Any text editor — Notepad, TextEdit, gedit, or even Microsoft Word in plain-text mode — can create and save a text file.
  • Text files are safe to share, open on any device, and won't change format when moved between computers.

Creating a text file on Windows

The fastest way on Windows is to use File Explorer. Navigate to the folder where you want the file, right-click in the empty space, and look for a menu that says "New". Hover over it, and you'll see "Text Document" as an option. Click it, and Windows creates a file called "New Text Document.txt".

Rename it immediately by right-clicking the file and choosing "Rename", or by pressing F2 with the file selected. Type the name you want — for example, "grocery-list.txt" — and press Enter. The .txt extension is already there, so you don't need to type it unless you want a different name structure.

If you prefer to use an application, open Notepad (search for it in the Windows Start menu), type or paste your content, then go to File > Save As. Choose where you want to save it, give it a name, make sure the file type is set to "Text Documents (.txt)", and click Save.

Creating a text file on Mac

On Mac, the built-in TextEdit application can create text files, but it defaults to a formatted document type. Open TextEdit (find it in Applications > Utilities), then go to the Format menu at the top and click "Plain Text". This switches the document from rich text to plain text mode.

Type or paste your content, then go to File > Save. Give the file a name and make sure it ends with .txt — for example, "notes.txt". Choose where you want to save it (your Desktop, Documents folder, or anywhere else), and click Save. If a dialog box asks whether to use the .txt extension, click "Use .txt".

Alternatively, you can use a free text editor like BBEdit or Visual Studio Code, both of which default to plain text and make it obvious what format you're saving in.

Creating a text file on Linux

Linux users have several options. The quickest is to open a terminal and use the touch command: type touch filename.txt and press Enter. This creates an empty text file with that name in your current directory. You can then open it in any text editor to add content.

If you want to create and edit the file in one step, open a graphical text editor like gedit, Kate, or Pluma (depending on your Linux distribution). Type your content, go to File > Save, give it a name ending in .txt, and click Save. For command-line editing, you can use nano or vi, though these have a steeper learning curve for new users.

Where to save your text file

Save your text file wherever makes sense for how you'll use it. If it's a temporary note, your Desktop is fine. If it's something you'll reference often — like a list of passwords or a template — put it in a dedicated folder like Documents or a folder you create specifically for that purpose.

Avoid saving text files in system folders (like Windows\System32 or /usr/bin) unless you know exactly what you're doing, because editing the wrong file can break your operating system. Stick to your user folders: Desktop, Documents, Downloads, or custom folders you create yourself.

Opening and editing your text file

Once you've created a text file, you can open it by double-clicking it. Windows and Mac will open it in Notepad or TextEdit by default. On Linux, it depends on your system settings, but it will usually open in your default text editor.

You can also right-click the file and choose "Open With" to pick a different program. This is useful if you want to open a .txt file in a code editor like Visual Studio Code or Sublime Text, or if your default program isn't the one you prefer. Any text editor can open and edit a .txt file without changing its format.

Converting other files to text format

If you have a document in another format — like a Word file (.docx) or a PDF — and you want to convert it to plain text, the process depends on the original format. In Microsoft Word, open the file, go to File > Save As, and change the file type dropdown to "Plain Text (.txt)". Word will strip out all formatting and save only the text content.

For PDFs, you'll need a separate tool. Some PDF readers have a "Save As Text" option, or you can use an online converter (search "PDF to text converter"). Be cautious with online tools if the document contains sensitive information — use a local tool or your own computer instead.

Frequently Asked Questions

Can I create a text file without using an application?

Yes. On Windows, right-click in a folder and select New > Text Document. On Mac, use the terminal command touch filename.txt. On Linux, use the same terminal command. All three methods create an empty .txt file you can then open and edit.

What's the difference between a .txt file and a .doc or .docx file?

A .txt file contains only plain text with no formatting, fonts, colors, or images. A .doc or .docx file (Word format) can include all of those things. Text files are simpler, smaller, and open on any device, but they can't store formatted content. Use .txt for plain information and .docx when you need formatting.

Is it safe to open a .txt file from someone I don't know?

Text files themselves cannot carry viruses or malware — they're just text. However, the content inside could be misleading or contain instructions you shouldn't follow. Read the file first before acting on what it says, just as you would with any message from an unknown source.

Can I change a file's extension from .docx to .txt to convert it?

No. Simply renaming the extension doesn't convert the file — it just changes the label. The file still contains Word formatting underneath. Use your application's Save As feature (in Word, go to File > Save As and choose Plain Text) to actually convert the content.

What should I use to edit a text file after I create it?

Any text editor works: Notepad on Windows, TextEdit on Mac, or gedit on Linux. For more advanced editing, Visual Studio Code, Sublime Text, or Atom are free and work on all three systems. The choice depends on what you're doing — simple notes need only Notepad, but code or configuration files benefit from editors that highlight syntax.