How to Create an HTML File

In this lesson we will learn how to create an HTML file. An HTML file is a plain text file with either .htm or .html as its file extension. The three letter extension (.htm) hails back to a time when computers would only allow up to three letters in the file extension. You can use either the .htm or the .html extensions. It doesn’t matter which one you use, but it is more common to use the .html extension nowadays.

And what do you need to create an HTML file? If you are using a Windows machine, somewhere on your computer you’ll have both the Notepad the WordPad programs. Both are fine text editors for creating HTML files with. If you are using a Macintosh computer, then you likely have a program called TextEdit which should work fine. If you are using a Linux machine, you will have to find the text editor that comes with it.

How to Create an HTML File with Notepad (Windows)

On a Windows computer, one of the easiest ways to create a plain text file is to use a program called Notepad. Notepad can save files only in the plain text format, which is what we want.

On most Windows machines, to open Notepad you click on Start > All programs > Accessories > Notepad. Getting to Notepad on your particular computer may be different, but that will work for most Windows computers.

Because it was designed to write plain text files, Notepad by default saves all files with a .txt extension. For instance, if you tried to save a file as example.html, Notepad would actually save it as example.html.txt. We DON’T want that to happen. To save a file in Notepad with the .html extension, do the following:

  1. Click on File > Save As to open the file-save-as dialog box.
  2. Click in the Save as type drop-down and select All Files. (This step is what prevents Notepad from automatically adding the .txt extension.)
  3. After you do that, type the desired filename including the .html extension
  4. Click on the Save button.

Once you have saved the file the first time, if you modify the file later, you simply have to click on File, and then on Save (or simply press Ctrl-S), to save the changes.

How to Create an HTML File with WordPad (Windows)

WordPad on most Windows computers is also found in the Accessories folder just like Notepad. WordPad is a very simple word processor that comes with Windows, but, unlike Notepad, it allows you to perform some simple formatting on the text. For instance, you can bold, italicized, and underline text in a WordPad document. However, we do NOT want to do this at all if we use WordPad to edit our HTML documents. HTML documents must be plain text documents.

Because WordPad allows you to format the text, by default it saves files in the rich text file format with a .rtf extension. However, we do not want an .rtf extension on our filenames. To save an HTML file in WordPad, do the following:

  1. Click on File > Save As. This will open the file save as dialog box.
  2. Click on the Save as type drop-down box and select the Text Document option. (This step causes WordPad to save the file as a plain text file.)
  3. In the Filename field, type the desired filename being sure to add the .html extension onto the end of the filename.
  4. Click the Save button.
  5. A warning box will pop up informing you that you are about to save the file in a text-only format that will remove all formatting. It will ask you if you really want to do this. Click on the yes button.

Just like Notepad, after you have saved the file for the first time, if you should update the file later, you merely need to click on File > Save.

Other Text Editors

For all the lessons and tutorials on this website, I will be assuming that you’re using Notepad. If you are using some other editor, you’ll have to work out the details of saving files with a .html extension on your own.

Unfortunately, I do not own a Macintosh, and, therefore, I cannot give any particulars on how to save files with TextEdit. I also do not use Linux (although I have in the past), and so I cannot provide any particulars on Linux text editors either—except to say that I know that every Linux distribution will include a plain text editor.

This entry was posted in HTML Tutorials. Bookmark the permalink.

Comments are closed.