Open In App

What is a Text File?

Last Updated : 20 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

A file is basically a container that contains data. A text file is a very important and simplest kind of file. Text file is used to store data in textual format.

What is a Text File?

A text file is a file that contains data in the form of text. This is used to store and share textual data and is useful for human and software systems. A text file generally uses a simple character encoding such as UTF-8 and ASCII. text is a collection of alphanumerical characters.

A text file is non-executable. A text file can be identified by a vivid kind of extension associated with its types such as .txt, .csv, .html, .xml, .py, .log, etc. In some programming issues codes of various software are written in form text files before execution. For example, before making a web page its code needs to be created in the form of a text file of a .html extension.

filejjj

A text file created by Notepad.

Types of Text File

There are many types of text file as follows:

1. Plain Text File

This is a type where there is no special formatting of text such as italic, bold, heading, subheading etc. In Microsoft OS Notepad is used to create plain text file. In Microsoft OS These files are saved with the .txt extension.

2. Comma Separated File

This file remains in .csv extension. This file is used to contain tabular data. Each line represents a record, and fields within each record are separated by commas.

3. HTML File

HTML file is used to create websites and web applications. This is saved with .html extension. In this file all textual data is contained in Hyper Text Markup Language.

4. Doc and Docx file

This type of file is created by MS word in Microsoft OS. In this kind of file Text can be stored in a proper format. Heading, footer can be added. and bold, italic and various types of fonts can be used in writing.

5. Markdown File

In this type of file text is written through Markdown language. This type of file is used to create proper documentation. This file uses .md extension.

6. Programming language Source code File

Text file is also used write programming code of various languages such as python, Javascript, C etc. This file can be saved in various extension according to the programming language such as .py for python, .js for javascript etc.

Files and Their Extension

File Type

Extension

plain text

.txt

markdown

.md

comma separated file

.csv

word file

.docx

HTML file

.html

python code file

.py

C code file

.cpp

How To Open a Text File?

Opening a text file depends on OS. A file which does not contain textual content also can be open as a text file. If you are using windows, you just have to right click on the icon of text file and then select the option to open as text file.

For opening a text file in MacOS you have to right click on the icon and just have to select the text editor. By above methods you can open any file in the form of text file even those which are not contain textual data.

Converting Text File

Converting a text file means to change the file format of a text file. There can many reasons of converting of a text file. A text editor itself provides facility to save a text file in a specific format. for example, you can save a text file in various format such as HTML, XML, YML, CSV etc.

FAQs on Text File

Q.1: What is a text file?

Answer:

A text file is file that contains textual data. Each text file uses a specific charater encoding. It can be created using text editors such Notepad++, vim, text editor etc.

Q.2: What is character encoding?

Answer:

Character encoding is a process which is used to define massage in form of text. UTF-8 and ASCII are example of character encoding.

Q.3: What is the common file extension for text files?

Answer:

A text file can be in many formats. “.txt” for windows OS, “.text” for MacOS are used as a common extension though there are many extensions as .html, .py, .xml, .js, .java etc.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads