Text file
| Text file | |
|---|---|
| Filename extension |
.text, .txt |
| Internet media type |
text/plain |
| Type code | TEXT |
| Uniform Type Identifier (UTI) | public.plain-text |
| UTI conformation | public.text |
| Type of format | Document file format, Generic container format |
A text file (sometimes spelled textfile; an old alternative name is flat file) is a kind of computer file that is structured as a sequence of lines of electronic text. A text file exists stored as data within a computer file system.
In operating systems such as CP/M, where the operating system does not keep track of the file size in bytes, the end of a text file is denoted by placing one or more special characters, known as an end-of-file (EOF) marker, as padding after the last line in a text file.[1] In modern operating systems such as DOS, Microsoft Windows and Unix-like systems, text files do not contain any special EOF character, because file systems on those operating systems keep track of the file size in bytes.[2]
Some operating systems, such as Multics, Unix-like systems, CP/M, DOS, the classic Mac OS, and Windows, store text files as a sequence of bytes, with an end-of-line delimiter at the end of each line. Other operating systems, such as OpenVMS and OS/360 and its successors, have record-oriented filesystems, in which text files are stored as a sequence either of fixed-length records or of variable-length records with a record-length value in the record header.
"Text file" refers to a type of container, while plain text refers to a type of content.
At a generic level of description, there are two kinds of computer files: text files and binary files.[3]
- ^ "EOF: What it Means and How It's Used in Programming". Itexus. Retrieved 5 September 2025.
- ^ "Testing for the End of a File". Microsoft Learn. Microsoft. Retrieved 5 September 2025.
- ^ Lewis, John (2006). Computer Science Illuminated. Jones and Bartlett. ISBN 0-7637-4149-3.