A text file contains only letters, numbers, and symbols — nothing else

A text file is the simplest kind of file your computer can store. It holds only characters you can type on a keyboard: letters, numbers, punctuation, and spaces. No images, no formatting, no hidden instructions. When you open a text file, you see exactly what is in it, with no surprises.

The most common text file is one with a .txt extension, like notes.txt or shopping_list.txt. But many other file types are actually text files underneath — including .csv files (spreadsheets), .html files (web pages), .json files (data), and .py files (Python code). The difference is what the content means, not what it is made of.

You can open a text file with any text editor: Notepad on Windows, TextEdit on Mac, or gedit on Linux. You do not need special software. You can also open text files in a web browser, email client, or word processor — though a word processor might try to add formatting, which changes the file.

Key Takeaways

  • Text files contain only characters — letters, numbers, symbols, and spaces — with no images, colors, or formatting.
  • The .txt extension is the standard, but many other file types like .csv, .html, and .json are text files with different purposes.
  • You can open any text file with Notepad, TextEdit, or any basic text editor without installing special software.
  • Text files are smaller, faster to load, and work on any device, which is why they are used for code, data, and configuration.

How text files differ from other file types

A word processor file like .docx (Microsoft Word) or .odt (LibreOffice) looks simple on screen, but it is actually a container holding multiple files inside: the text, formatting instructions, images, fonts, and metadata. When you save it, all of that gets bundled together. A text file has none of that — just the words.

A PDF file is also not a text file, even though it contains text you can read. PDFs are designed to look the same on any device, so they store exact instructions about where each letter goes, what font to use, and how to arrange the page. You cannot edit a PDF the way you edit a text file — you need a PDF editor.

Image files like .jpg or .png store data about pixels and colors. Audio files like .mp3 store sound waves. These are binary files — they contain data that is not readable as characters. If you try to open a binary file in a text editor, you will see garbage characters instead of anything meaningful.

What you can and cannot do with text files

Text files have no formatting — no bold, italics, colors, or different font sizes. If you need those things, a text file is not the right choice. But that simplicity is also their strength: text files are tiny, they load instantly, and they work everywhere.

You cannot embed images or videos in a text file. You can only reference them — for example, by typing a file path or a web address. If you need to include an image alongside text, you need a different format like .docx or .html.

Text files are perfect for storing lists, notes, code, configuration settings, and data. Programmers use text files for source code because code is just text with special meaning. System administrators use text files for configuration because they are easy to read and edit without special tools. Data scientists use .csv text files to store spreadsheet data because they are simple and portable.

Character encoding and why it matters

Text files need to know which character set to use — which is called encoding. The most common encoding today is UTF-8, which can represent any language: English, Chinese, Arabic, emoji, and thousands of others. Older files sometimes use ASCII, which only handles English letters and basic symbols.

Most of the time, your text editor handles encoding automatically and you never think about it. But if you open a text file and see strange characters instead of readable text, the editor may have guessed the wrong encoding. Most text editors let you change the encoding in a menu — usually under File or Settings — and try again.

When you save a text file, your editor will ask which encoding to use. UTF-8 is the safe choice for almost everything. ASCII is only necessary if you are working with very old systems or if you know the file must contain only English characters.

How to create and edit a text file

On Windows, right-click on your desktop or in a folder, select New, then Text Document. Name it whatever you want and add .txt at the end. Double-click to open it in Notepad and start typing.

On Mac, open the Applications folder, go to Utilities, and launch TextEdit. Go to Format menu and select Make Plain Text — this is important, because TextEdit defaults to rich text. Then type your content and save with .txt at the end.

On Linux, right-click in a file manager and select Create Document or Create File, or open a terminal and type nano filename.txt to create and edit in one step.

If you already have a text file, you can open it by right-clicking and selecting Open With, then choosing Notepad, TextEdit, or any text editor. You can also drag the file onto a text editor icon to open it.

Common text file formats and what they are used for

The .txt extension is generic — it just means "text file". But many specialized text file formats exist for specific purposes, and they all work the same way underneath:

  • .csv — Comma-separated values. Used for spreadsheet data. Each line is a row, and commas separate columns. You can open it in Excel or Google Sheets, but it is still just text.
  • .html — HyperText Markup Language. The format for web pages. It is text with special tags that tell a browser how to display it.
  • .json — JavaScript Object Notation. Used for storing structured data. Common in web applications and APIs.
  • .xml — Extensible Markup Language. Similar to HTML but used for storing and sharing data between systems.
  • .py, .js, .java — Programming languages. Source code files are text files with a specific syntax.
  • .log — Log files. Records of what a program did, stored as text for troubleshooting.
  • .ini or .conf — Configuration files. Settings for programs and systems, stored as text.

All of these are text files. You can open any of them in Notepad and read the raw content. Whether it makes sense depends on whether you understand the format, but the file itself is just text.

Why text files are still important

Text files have been around since computers began, and they are not going away. They are the foundation of the internet, programming, and data storage. Every website, every app, every piece of software starts as text files written by programmers.

Text files are also future-proof. A .txt file you create today will open on any computer in 50 years. A Word document from 2005 might not open in future versions of Word, but a text file is always readable. This is why important records — legal documents, scientific data, historical archives — are often stored as text.

Text files are also the most secure format for sensitive information. They cannot contain viruses or hidden code. They cannot track you or phone home. What you see is what you get.

Frequently Asked Questions

Can I convert a Word document to a text file?

Yes. Open the document in Word, go to File > Save As, and change the file type to Plain Text (.txt). All formatting will be removed — only the words remain. If the document has images, they will be lost.

What is the difference between .txt and .text?

There is no technical difference. Both are text files. .txt is the standard extension, and most programs expect it. .text is rarely used and some programs may not recognize it. Stick with .txt.

Why does my text file look different when I open it in different programs?

The content is the same, but different programs display text differently. One editor might use a larger font, different colors, or different line spacing. The actual file has not changed — only how it is displayed. If you edit and save it, the changes are saved as plain text.

Can I open a text file on my phone?

Yes. Any phone has a text editor or notes app that can open .txt files. On iPhone, use Notes or a third-party app like iA Writer. On Android, use Google Keep, Notepad, or any text editor from the Play Store. You can also email the file to yourself and open it from your email.

Is a text file the same as a plain text file?

Yes. "Plain text" and "text file" mean the same thing — a file with no formatting, just characters. The term "plain text" is sometimes used to emphasize that there is no hidden formatting, especially when comparing to a word processor file.