HTML files open in your web browser, not in a text editor

An HTML file is a plain text document that contains instructions for how a web page should look. When you double-click an HTML file on your computer, your browser reads those instructions and displays the page. You do not need special software — your computer already has what you need.

The confusion usually comes from the fact that HTML files have two possible lives. You can open them to see the finished web page (what visitors see), or you can open them in a text editor to read and change the code underneath. This guide covers opening them to view the page. If you need to edit the code, that is a different process.

The simplest method is to find the HTML file on your computer and double-click it. Your default browser will open and display the page. If that does not work, or if you want to use a different browser, the steps below show you how.

Key Takeaways

  • Double-clicking an HTML file opens it in your default web browser, which is the normal way to view it.
  • If double-clicking does not work, right-click the file and choose "Open with" to pick a specific browser.
  • On Windows, your default browser is usually Microsoft Edge or Chrome; on Mac, it is usually Safari.
  • HTML files stored on your computer work the same way as web pages you visit online — they just live in a folder instead of on the internet.

Opening an HTML file by double-clicking

Find the HTML file in File Explorer (Windows) or Finder (Mac). HTML files have a small icon that looks like a bracket or angle symbol, and the filename ends in .html or .htm. Double-click the file once.

Your web browser will open and display the page. This is the fastest method and works on both Windows and Mac computers. If nothing happens when you double-click, move to the next section.

Opening an HTML file when double-clicking does not work

If double-clicking does not open the file, your computer may not have a default browser set, or the file may be associated with a text editor instead. Right-click the HTML file and look for a menu option that says "Open with" or "Open with...".

A list of programs will appear. Look for your web browser — Chrome, Firefox, Safari, or Microsoft Edge. Click the browser name. The file will open in that browser, and you can use it as your default from now on. If you see only text editors like Notepad in the list, scroll down or look for "More apps" to find your browser.

On Mac, right-click the file and select "Open With", then choose your browser from the list. On Windows, right-click and select "Open with", then click "Choose another app" if you do not see your browser in the first menu.

Setting a default browser so HTML files always open correctly

After you open an HTML file with a specific browser, you can make that browser the default so all HTML files open in it automatically. On Windows, open Settings, go to Apps, then Default apps, and find HTML Document in the list. Click it and select your preferred browser.

On Mac, right-click an HTML file, select "Open With", choose your browser, then click "Always Open With". From that point forward, all HTML files on your computer will open in that browser when you double-click them.

Opening HTML files that are stored in folders or on a USB drive

HTML files work the same way no matter where they are stored. If the file is in a folder on your desktop, in your Documents folder, or on a USB drive, the process is identical — find it and double-click it, or right-click and choose your browser.

One thing to remember: if an HTML file refers to other files (like images or stylesheets), those files need to be in the same folder or in a subfolder for the page to display correctly. If you move just the HTML file to a different location and leave the other files behind, the page may look broken. Keep related files together.

Why your HTML file might look different than you expected

Sometimes an HTML file opens in your browser but looks plain or incomplete. This usually means the file is missing images, stylesheets, or other resources it needs. Check that all the files that came with the HTML file are in the same folder.

Another reason is that some HTML files are designed to work only when they are on the internet, not when they are opened from your computer. These files may have broken links or missing content. This is normal and not a problem with your computer — it is how the file was built.

Opening HTML files from the internet and saving them to your computer

If you find an HTML file online and want to save it to your computer, right-click the link and select "Save link as" (or "Save target as" on some browsers). Choose where you want to save it, then click Save. Once it is on your computer, you can open it the same way you would any other HTML file.

Be aware that saving a web page this way may not capture all the images and styling. For a complete copy of a web page, use your browser's "Save page as" option instead, which saves the page and its resources together.

Frequently Asked Questions

Can I edit an HTML file after I open it in my browser?

No. When you open an HTML file in your browser, you are viewing the finished page, not the code. To edit the code, you need to open the file in a text editor like Notepad (Windows) or TextEdit (Mac), make your changes, save the file, then refresh your browser to see the changes.

What is the difference between .html and .htm?

There is no practical difference. Both are HTML files and open the same way. The .htm extension is older and was used when some systems limited filenames to three-letter extensions. Modern computers use .html, but both work identically.

Why does my HTML file open in Notepad instead of my browser?

Your computer is set to open HTML files with Notepad by default. Right-click the file, select "Open with", choose your browser, and on Windows click "Always use this app" to change the default. On Mac, select "Always Open With" instead.

Can I open an HTML file if I do not have internet?

Yes. HTML files on your computer do not need the internet to open and display. They work exactly the same whether you are online or offline. The only time you need internet is if the HTML file contains links to pages or images that are stored on the web.