How to create an HTML file is one of the first basic skills you need when starting with web pages. The good news is that you do not need advanced software: a simple text editor and a browser are enough to see the result right away.
What an HTML file is
An HTML file is a text document that contains markup a browser reads as the structure of a web page. It defines headings, paragraphs, links, images, and other page elements.
The key rule is simple: the file must be saved with the .html or .htm extension. That tells the system to open it as a web page.
How to create an HTML file on a computer
The easiest method is to open a regular text editor, type the code, and save it in the correct format. This works on Windows, macOS, and Linux.
Basic steps
- Open a text editor, such as Notepad or another basic editor.
- Enter the HTML code for your page.
- When saving, choose a name like index.html.
- Make sure the file type does not switch to .txt.
- Open the file in a browser to check the result.
If you use a more advanced code editor, the process becomes even easier. These tools highlight syntax, suggest tags, and help you spot mistakes faster.
Example of a minimal HTML document
To create a working file, a simple template like this is enough:
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
</head>
<body>
<h1>Hello!</h1>
<p>This is my first HTML file.</p>
</body>
</html>
After saving the file, open it in your browser. You should see the heading and text displayed as they would appear on the page.
What to check when saving the file
The most common beginner mistake is creating a file named something like index.html.txt. It may look correct on screen, but the browser will not treat it as an HTML document.
- Check the file extension.
- Use simple file names without spaces unless you know how your system handles them.
- If the content opens as a plain document, the file was not saved correctly.
How to quickly verify the result
After saving, double-click the file or open it manually in a browser. If everything is correct, the page will load without any extra setup.
For convenience, you can create a separate project folder for your HTML file, images, and other assets. That makes it much easier to stay organized as the page grows more complex.
So, if you want to know how to create an HTML file, start with a simple text editor, save the document with the .html extension, and test it in a browser. It is the quickest way to build your first web page without unnecessary tools.

