An HTML file is a plain text document with an .html extension that a web browser can read and display as a webpage
You create an HTML file the same way you create any text file — by opening a text editor, typing content, and saving it with the .html extension instead of .txt. The browser then reads the tags in that file and turns them into the formatted page you see on screen. You do not need special software or an internet connection. A basic HTML file can be created in Notepad on Windows, TextEdit on Mac, or any other plain text editor.
The key difference between an HTML file and a regular text file is the extension and the content inside. When you save a file as index.html or mypage.html, the browser knows to interpret the angle brackets and tag names as instructions rather than text to display. Without the .html extension, the browser will not know what to do with the file.
Key Takeaways
- Save your file with an .html extension (like index.html or about.html) so the browser recognizes it as a webpage.
- Use a plain text editor like Notepad, TextEdit, or VS Code — not a word processor like Microsoft Word.
- Type your HTML tags and content directly into the file, then save it to your computer.
- Open the saved file in any web browser by double-clicking it or dragging it into a browser window.
- The file lives on your computer until you upload it to a web server if you want others to see it online.
Open a plain text editor and start with a basic HTML structure
On Windows, right-click on your desktop or in a folder, select New, then Text Document. On Mac, open TextEdit from Applications > Utilities, then go to Format menu and choose Make Plain Text. This step matters because word processors like Microsoft Word add hidden formatting that breaks HTML.
Once the editor is open, type the basic HTML structure that every webpage needs:
<!DOCTYPE html> <html> <head> <title>My First Page</title> </head> <body> <h1>Hello World</h1> <p>This is my first webpage.</p> </body> </html>
This structure tells the browser where the page begins and ends, where the title goes (the text that appears in the browser tab), and where the visible content lives. You can change "My First Page" and "Hello World" to whatever you want, but keep the tags exactly as they are.
Save the file with the .html extension
Go to File > Save As. In the filename field, type a name followed by .html — for example, index.html or mypage.html. The extension is what tells your computer and browser that this is a webpage file.
Choose where to save it — your Desktop or a folder you create for your project are both fine. Do not save it inside Program Files or System folders. If you are using TextEdit on Mac, make sure the file format is set to Plain Text, not Rich Text Format, before you save.
After you click Save, the file now exists on your computer as an HTML file. You can see it in your file explorer or Finder with a small icon next to its name.
Open the file in a web browser to see your webpage
Find the HTML file you just saved. Right-click it and select Open With, then choose your browser — Chrome, Firefox, Safari, or Edge. You can also drag the file directly into an open browser window. The browser will read the HTML tags and display your page.
You should see "Hello World" as a large heading and "This is my first webpage." as regular text below it. The browser tab will show "My First Page" as the title. This is your HTML file working — the browser converted your tags into a formatted page.
If something looks wrong or you see the raw tags instead of formatted text, go back to your text editor, check that you typed the tags correctly, save the file again, and refresh the browser (press Ctrl+R on Windows or Cmd+R on Mac).
Edit your HTML file by opening it in your text editor again
To add more content or change what is there, right-click the HTML file and select Open With, then choose your text editor. Make your changes — add more paragraphs, headings, links, or images — then save the file. You do not need to use Save As again; just Save will update the existing file.
After you save, switch back to your browser and refresh the page. The browser will reload the updated HTML file and show your changes. This cycle — edit in the text editor, save, refresh in the browser — is how you build and test webpages.
Use a code editor for easier HTML writing
Plain text editors work, but code editors like Visual Studio Code (free, from Microsoft), Sublime Text, or Notepad++ make HTML easier to write. They highlight your tags in different colors so mistakes stand out, auto-complete closing tags, and show you line numbers so you can find errors faster.
read and install one of these editors, then open your HTML file inside it the same way you would in Notepad. The file itself is still just plain text with an .html extension — the editor just makes it easier to work with. Many developers use code editors even for straightforward projects because they catch mistakes before you open the file in a browser.
Your HTML file stays on your computer until you upload it
Right now, your HTML file lives only on your computer. Other people cannot see it unless they have access to your machine. If you want to share your webpage with the world, you need to upload the file to a web server — a computer that runs 24/7 and is connected to the internet. Web hosting companies like Bluehost, GoDaddy, or Namecheap provide servers where you can upload your HTML files.
For now, creating and viewing HTML files on your own computer is the right way to learn and test. Once you are comfortable with HTML, you can explore uploading files to a server if you want to publish a real website.
Frequently Asked Questions
Can I create an HTML file in Microsoft Word?
No. Word adds hidden formatting codes that break HTML. Always use a plain text editor like Notepad, TextEdit, or a code editor. If you only have Word available, you can copy plain text into Notepad and save it as .html from there.
What if I save the file as .txt by mistake?
The browser will not read it as a webpage. Right-click the file, select Rename, and change the extension from .txt to .html. The browser will then recognize it and display it correctly.
Do I need internet to create and view HTML files?
No. Creating HTML files and viewing them in your browser works entirely offline. You only need internet if you want to upload the file to a web server so others can see it online.
Can I have multiple HTML files in the same folder?
Yes. You can create index.html, about.html, contact.html, and many others in the same folder. You can link them together using anchor tags so visitors can navigate between pages.
What happens if I open an HTML file in two browsers at once?
Both browsers will display the same file. If you edit the file and save it, you can refresh both browsers and they will both show the updated version. This is useful for testing how your page looks in different browsers.