A text file is a computer file that stores text encoded in a character encoding, such as ASCII, Unicode, or UTF-8. Text files are often used to store documents, code, and other information that is primarily text-based. Text files can be created and edited using a variety of text editors, such as Notepad, TextEdit, and Sublime Text.