Skip to content
Home

Text file (plain text)

A text file is a sequence of characters stored as readable text. This article explains its structure, history, common formats, tools for editing, and differences from binary or formatted documents.

Overview

A text file is a computer file that stores human-readable characters in sequence, typically organized into lines. It contains plain text rather than application-specific formatting or embedded binary objects. Plain text files are widely used for short notes, program source code, configuration settings and logs because they are simple, portable and easy to inspect with basic software. For a concise definition see primary reference.

Image gallery

1 Image

Key characteristics

Text files have several practical properties that distinguish them from other file types:

  • Encoding: Contents are encoded with a character encoding such as ASCII or Unicode (UTF-8), which maps characters to numeric values.
  • Line structure: Data is arranged as a sequence of lines separated by newline characters (different systems use different conventions).
  • Human-readable: Most content can be read and edited with simple editors; examples include Notepad and other text editors.
  • Minimal metadata: Plain text lacks the formatting instructions, styles, or embedded media that appear in word-processor or binary files.

History and development

Early computing relied heavily on plain text because early storage and display systems were limited to characters. As personal computing evolved, text files remained fundamental: configuration files, scripts and source code stayed in plain text to maintain portability. Over time, character encodings expanded beyond 7-bit ASCII to accommodate international scripts, and conventions grew around newline handling and byte-order marks.

Common formats and extensions

Typical extensions for plain text include .txt, .csv (comma-separated values) and .md (markdown). Some extensions that users may associate with documents—such as .doc—usually denote files created by word processors; these files include formatting information and are not strictly plain text. The difference between plain text and binary files is important: a binary file contains encoded data not intended for direct human reading; see binary data and general data concepts. For a comparison with formatted documents, consult resources on word processing.

Uses and examples

Text files serve many everyday purposes: writing notes, drafting code, storing configuration, logging program activity, and exchanging tabular data in CSV form. Their simplicity makes them suitable for automation and version control. System administrators and programmers commonly prefer plain text for files that must be diffed, merged or processed by scripts.

Viewing, editing and interoperability

Because plain text is widely supported, nearly every operating system includes tools to view or edit it. On Windows, simple programs like Notepad open text files, while development environments and dedicated editors provide rich features for programmers. When exchanging files between platforms, attention to character encoding and newline conventions helps avoid corruption. Learning the distinctions between plain text (plain text) and other formats is useful when deciding how to store or share information.

History

In the early days of electronic data processing, the distinction between text and binary files was simpler than it is today. In a text file, a character was always converted directly into a special bit pattern. The file could be transmitted to a terminal, printer or teleprinter without any detours - that is, character by character, without any conversion by a special program. The Baudot code used for transmission between teleprinters is also the origin of the control characters "line feed" or "carriage return" found in text files.

Character coding is used to convert the physically stored bit sequences in a text. In the past, a character was almost exclusively always converted into exactly one byte, i.e. as a rule a group of 8 bits, which thus made 256 (corresponding to 28) different characters possible. In the coding using ASCII in the original definition, only 7 bits were actually used.

With the 7- or 8-bit character sets, only one font can be used in a file at a time; the use of different languages is only possible to a limited extent. The East Asian writing systems, such as Japanese, Chinese and Korean, can practically not be mapped at all. In 1986, ISO 2022 was the first standard to allow the use of different fonts in a text file, and it also provided for fonts using more than 256 different characters. However, this standard only achieved significant distribution in the East Asian region and was superseded by Unicode, which was first published in 1991 and is intended to represent all existing writing systems in the long term.

At the latest since the introduction of Unicode, the conversion of a character into its binary representation has become more complicated, since there are several variants for this and a character is not always converted with the same number of bytes.

Since the exchange of files between different computer systems has become more important, not least due to the Internet, and text files make it easier to process files independently of the system compared to binary files, the text format has gained in importance. However, in particular also due to the diverse use of text files, the term itself has become more inappropriate and blurred.

Distinction between binary and text files

Many operating systems have conventions regarding the extension of file names to identify the file type. Under Windows and macOS, the extension .txt is usually appended to the name of a text file, and other operating systems such as Linux also sometimes use this file extension.

The Multipurpose Internet Mail Extensions (MIME), which were designed to standardize the technical format of e-mails, define so-called media types that are now also used in many other areas besides e-mail traffic to identify the file type. The media type text identifies text. The complete type specification is supplemented by a subtype that specifies the intended use of the text. For text files that directly contain the "actual" text that is not intended for specific machine processing, the complete type specification is text/plain.

No special formatting, such as bold emphasis, can be specified for the text contained in a text file. Some encodings allow the stacking of diacritical characters or the display of bidirectional text.

A file created with a word processor (such as Microsoft Word or LibreOffice Writer) is normally not a text file, even if only text was captured, because the text can only be viewed and edited again using a suitable word processor. Text created in PostScript (.ps), Portable Document Format (PDF, .pdf), or TeX-DVI (.dvi) is also not a text file because it contains encoded format information, which may be binary. Similarly, text that is read in by a scanner is not a text file. These are rather image files, unless they are converted into a text file after the scanning process by means of a text recognition software (OCR, optical character recognition).

When compressing data, a significantly larger saving in memory size can usually be achieved for text files than for binary files. This is because text files have a lower information density than most binary files, and common compression algorithms take advantage of this - for example, by using Huffman coding.

Related articles

Author

AlegsaOnline.com Text file (plain text)

URL: https://en.alegsaonline.com/art/97313

Share