HTML files open in your web browser, not in a word processor
An HTML file is a plain-text document written in a language that web browsers understand. When you open it, the browser reads the code and displays it as a formatted webpage. You do not need special software — every computer comes with at least one browser already installed. The file itself is just text, but the browser turns that text into the page you see.
The simplest way to open an HTML file is to double-click it. Your computer will open it in your default browser (usually Chrome, Safari, Edge, or Firefox, depending on what you use most). If that does not work, or if you want to open it in a different browser, you can drag the file onto a browser window or right-click and choose "Open with".
Key Takeaways
- Double-clicking an HTML file opens it in your default web browser, which is the fastest method on any computer.
- If double-clicking does not work, right-click the file, select "Open with", and choose a browser from the list.
- You can also drag an HTML file directly onto an open browser window to view it.
- HTML files display the same way in any browser, though the appearance may vary slightly depending on the browser version.
- Opening an HTML file locally (on your computer) does not require an internet connection.
Double-clicking the file (Windows)
On Windows, locate the HTML file on your computer. It will have a name ending in .html or .htm — both extensions mean the same thing. Double-click the file. Your computer will launch your default browser and display the page.
If the file opens in Notepad or another text editor instead of a browser, the file association is set wrong. Close the text editor, right-click the HTML file, and select "Open with". A menu will appear showing available programs. Click on your browser name (Chrome, Firefox, Edge, or Safari if you have it installed). If you want this browser to open all HTML files by default going forward, check the box that says "Always use this app to open .html files" before clicking.
Double-clicking the file (Mac)
On a Mac, find the HTML file in Finder. Double-click it. Safari (or your default browser) will open and display the page. If it opens in a text editor instead, the file association needs to be changed.
Right-click the file and select "Open With". A submenu will show available browsers. Click the one you want to use. To make this your default for all HTML files, select the browser name, then hold down the Option key and click "Open". This sets that browser as the default for this file type.
Dragging the file into a browser window
If you have a browser already open, you can drag an HTML file directly into it. Open your file manager (File Explorer on Windows, Finder on Mac) and locate the HTML file. Click and hold on the file, then drag it over the browser window and release. The browser will display the page.
This method works on any operating system and is useful if you want to open the file in a specific browser without changing your default settings. You can have multiple browsers open and drag the same file into whichever one you want to use.
Using the browser's File menu
You can also open an HTML file through the browser itself. Open your browser, then go to the File menu (or press Ctrl+O on Windows, Command+O on Mac). A dialog box will appear asking you to choose a file. Navigate to your HTML file, select it, and click "Open". The browser will display the page.
This method is helpful if you are not sure where the file is stored, because the dialog box lets you browse your entire computer. It also works if the file will not open by double-clicking for any reason.
What to do if the page looks wrong
Sometimes an HTML file opens but looks broken — text is misaligned, images do not appear, or the layout is jumbled. This usually means the HTML file is missing related files it needs, such as CSS files (which control styling) or image files that should be in the same folder.
Check that all the files are in the same folder as the HTML file. If the HTML file references images or stylesheets, those files need to be present for the page to display correctly. If you downloaded the HTML file from somewhere, make sure you downloaded the entire folder, not just the single HTML file. If images still do not appear, the file paths in the HTML code may be broken, and you would need to edit the HTML itself or contact whoever created the file.
Opening HTML files from the internet
If someone sends you an HTML file by email or you read one from a website, save it to your computer first, then open it using the methods above. Do not try to open it directly from the email or read notification — save it to your Desktop or Documents folder first.
HTML files downloaded from the internet are safe to open in a browser. The browser runs the code in a restricted environment and cannot access your files or settings without your permission. If the page asks for your password or personal information, be cautious — legitimate websites do not ask for sensitive information through local HTML files.
Frequently Asked Questions
Can I edit an HTML file after I open it?
Not in the browser — the browser only displays it. To edit the code, right-click the file, select "Open with", and choose a text editor like Notepad (Windows) or TextEdit (Mac). Make your changes and save the file. When you refresh the browser, you will see the updated version.
Why does my HTML file open in Notepad instead of a browser?
Your computer is set to open .html files with a text editor by default. Right-click the file, select "Open with", choose your browser, and check the box to make it the default. All HTML files will then open in that browser going forward.
Do I need the internet to open an HTML file?
No. HTML files stored on your computer open and display in the browser without an internet connection. However, if the HTML file contains links to external websites or images hosted online, those will not load without internet.
What is the difference between .html and .htm?
There is no functional difference. Both are HTML files and open the same way. The .htm extension is older (from when Windows limited file extensions to three letters) and is less common now, but browsers treat them identically.
Can I convert an HTML file to a different format?
Yes, but the method depends on what format you want. You can print an HTML file to PDF through the browser (File > Print, then select "Save as PDF"). For other formats like Word or plain text, you would need to copy the content from the browser and paste it into the target program, or use a file conversion tool designed for that purpose.