How to create a text file?

Open and use Notepad
Save the file as a text file
Create a new text document from the Desktop
Create a text file from the Windows command line
Create a text file from in a Linux shell

Open and use Notepad

Tip: A text file is considered a plaintext file and Notepad is only capable of creating and editing plaintext files and saves any text file with a .txt file extension. This means no special formatting or different types of fonts can be used.

The easiest way to create a text file in Windows is to open up the Notepad software program on your computer. This is a standard program in Microsoft Windows, included with the operating system when installed.

The Windows Notepad program can be found by following either of the steps below.

  1. Click Start
  2. In the Run or Search box type Notepad and press enter.

Or

  1. Click Start
  2. Open All Programs, Accessories, and then click Notepad.

Save the file as a text file

You can also create a text file using any other word processing software program, like Microsoft Word or Wordpad. When saving the file, change the file name or file type to Plain Text to save it as a text file. In many of these programs, you'll also have the option to save the file as a Rich-Text Format.

Save As option

After the file has been created and saved it can also be edited using Notepad or another word processing software program.

Create a new text document from the Desktop

Another way to create a text file is to right-click on your Desktop screen and in the menu that appears, click New and then click Text Document.

This opens your default text editor with a blank text file on your Desktop. You can change the name of the file to anything you want. You can edit the file in the Notepad program or any other word processing software program, like Microsoft Word.

Create a text file from the command line

While in the Windows command line you also have the ability to create a new text file in the current directory. With earlier versions of Windows, a new file of any type including text files could be created by using the edit command line command. Later versions of Windows removed this feature, so our current recommendation for creating a text file from the command line is by using the start command as shown in the example below.

start notepad myfile.txt

In the above example, you are using the start command to open notepad with the file "myfile.txt", assuming this file does not exist it would be created and saved in your current directory. If the file did exist, you would be editing that file.

Create a text file from in a Linux shell

There are several commands that can be used to create a text file in a Linux shell. The easiest command to create, view, and edit a text file or plaintext file is the pico command. To use this command, enter the below command at the prompt.

pico myfile.txt

After entering the above command, the editor will be opened and allow you to create a text file. When done, press Ctrl + X to exit the file, when prompted to save the file if you want to keep the file press "Y" for yes.

Tip: the .txt file extension is not required in Linux, it is an extension most commonly found and used with Windows. If you do not need the file to opened in Windows, you can have no file extension or rename it to whatever you want.

Additional information

  • See our text file definition for further information on this term and related links.