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

A text file is a document that contains only plain characters: the letters A through Z, numbers 0 through 9, spaces, punctuation marks, and a few invisible characters like line breaks. It does not contain formatting, images, sounds, videos, or any instruction for how the text should look. When you open a text file, you see exactly what is stored inside it, with no hidden layers underneath.

The most common text file on any computer is one with a .txt extension — the period followed by "txt" at the end of the filename. But text files come in other forms too. A .csv file (comma-separated values) is a text file that organizes data into rows and columns. A .html file is a text file that contains instructions for a web browser. A .py file is a text file that holds computer code. All of them are text files because they contain only plain characters, even though they do different jobs.

Key Takeaways

  • A text file contains only letters, numbers, spaces, and punctuation — no formatting, colors, fonts, or images.
  • The .txt extension is the simplest text file, but .csv, .html, .py, and many other extensions are also text files.
  • You can open a text file in any text editor on any device, and it will look the same everywhere.
  • A Word document or PDF is not a text file because it stores formatting and layout instructions along with the words.

How text files differ from formatted documents

A Microsoft Word document (.docx) or a Google Doc looks straightforward when you open it, but it actually contains far more than text. Underneath the words are instructions that say "make this part bold," "use this font," "put this image here," and "leave this much space on the left." The file stores both the text and all those invisible instructions together. When you email a Word document to someone else, you are sending all those instructions too, which is why the document might look different on their computer if they have different fonts installed.

A text file has no instructions at all. It is just the characters themselves. If you write "Hello world" in a text file, the file contains exactly those eleven characters — the letters, the space, and nothing else. No font choice, no color, no size. When someone opens that same file on a different computer, they see the same eleven characters, though the text editor they use might display it in whatever font that editor prefers.

A PDF works the same way as a Word document in this respect — it stores text plus detailed instructions for layout, fonts, images, and positioning. That is why a PDF looks identical on every device; the instructions are locked in. But those instructions make the file much larger and more complex than a text file would be.

Why text files are universal and reliable

Because a text file contains only plain characters with no hidden instructions, you can open it in almost any program on almost any device. On Windows, you can use Notepad. On a Mac, you can use TextEdit. On a phone, you can use Notes or any text editor app. On a Chromebook, you can use the built-in text editor. All of them will show you the same content because there is nothing to interpret — just characters on a screen.

This universality makes text files the safest way to store information that needs to survive for a long time or move between different systems. If you save something as a Word document, you depend on Microsoft Word (or a compatible program) existing in the future. If you save it as a text file, any device with a screen can show it to you fifty years from now. Government agencies, scientists, and programmers often use text files for this reason — they are the most durable format.

Text files are also much smaller than formatted documents. A Word document with a few paragraphs might be 50 kilobytes. The same text in a .txt file might be 2 kilobytes. That difference matters when you are sending files over email, uploading to a website, or storing thousands of documents.

What you cannot do in a text file

Because a text file has no formatting, you cannot make words bold, italic, or underlined within the file itself. You cannot change font size or color. You cannot embed images, videos, or links that work when clicked. You cannot create tables with borders and shading. If you need any of those things, you need a formatted document like Word, Google Docs, or a PDF.

Some text files use straightforward symbols to suggest formatting — for example, putting asterisks around a word like *this* to mean "this should be bold." But those asterisks are just characters in the file; they do not actually make the word bold. A program reading the file has to recognize that pattern and interpret it. The file itself contains only the asterisks and the word.

Common text file types and what they do

A .txt file is the simplest — just text, nothing else. A .csv file is text organized into rows and columns, separated by commas. Excel can open a .csv file and display it as a spreadsheet, but the file itself is just text with commas in it. A .log file is text that records events — when a program ran, what it did, and what went wrong. A .html file is text that contains instructions for a web browser, like "display this as a heading" or "make this a clickable link." A .json file is text organized in a specific pattern so that programs can read and understand it.

All of these are text files. You can open any of them in Notepad or any basic text editor and see the raw characters. A .csv file will look like rows of words separated by commas. A .html file will show you the angle brackets and tags that tell the browser what to do. A .json file will show you the structure of curly braces and quotation marks. None of them will look "formatted" the way a Word document does, because they are not.

How to create and save a text file

On Windows, right-click on your desktop or in a folder, select "New," then "Text Document." A new file appears with a default name. Type a new name and press Enter. Double-click it to open it in Notepad, type your content, and press Ctrl+S to save. On a Mac, open TextEdit from Applications, go to Format menu and select "Make Plain Text," then type your content and save with Command+S. Make sure the filename ends in .txt so the system knows it is a text file.

You can also open Notepad (Windows) or TextEdit (Mac) first, type your content, and then save the file with a .txt extension. Many other programs create text files too — if you use a code editor like Visual Studio Code, every file you create is a text file by default. The key is that the file contains only plain characters with no formatting instructions.

When to use a text file instead of a formatted document

Use a text file when you need something straightforward and portable — a to-do list, notes, a log of events, or data that will be read by a computer program. Use a text file when you are sharing information with someone who might not have the same software you do. Use a text file when the information needs to last a very long time and you want to be sure it will still be readable decades from now.

Use a formatted document (Word, Google Docs, PDF) when you need the text to look a certain way — with specific fonts, colors, images, or layout. Use a formatted document when appearance matters as much as content, like a resume, a report with charts, or a letter with a signature. Use a formatted document when you need features like comments, tracked changes, or the ability to print to an exact page size.

Frequently Asked Questions

Can I convert a Word document to a text file?

Yes. Open the Word document, go to File, select "Save As," and choose "Plain Text (.txt)" from the file type dropdown. The document will save as a text file, but all formatting — bold, colors, images, fonts — will be removed. Only the words themselves will remain.

Why does my text file look different on my phone than on my computer?

The content is identical, but the text editor app on your phone might use a different font or text size than the editor on your computer. The file itself has not changed; only how it is displayed has. This is normal and does not mean anything is wrong.

Is a text file the same as a .doc file?

No. A .doc or .docx file is a Word document that contains formatting instructions along with text. A .txt file contains only plain text. They are completely different formats, and a .txt file is much simpler.

Can I put a picture in a text file?

No. A text file can only hold characters. If you need to include an image with text, use a formatted document like Word, Google Docs, or a PDF instead.

What happens if I change the .txt extension to something else?

The file itself does not change — it still contains only plain text. But the system might try to open it with a different program. For example, if you rename a .txt file to .html, a web browser will try to open it and interpret the text as web code. The content is the same; only how the system treats it changes.