How to open a .html file
HTML document · Web / text
An .html file is a web page. Double-click it and your browser opens it. To see or change the code behind it, open the same file in a text editor instead.
What a .html file actually is
HTML is the markup language every web page is written in. A local .html file is exactly what a server would send you, just stored on your disk instead of fetched over the network.
The two things people want from an .html file are opposites: view it as a page, or read its source. Both are trivial, but they need different programs and that is where the confusion sits.
Why it will not open
Rarely does it fail to open at all. What surprises people is a saved page that renders without its images and styling, because those lived in a separate folder that was not kept alongside the file.
Renaming it to an extension you can open will not help: changing the extension does not convert the file, it only changes what Windows tries to open it with.
Step by step
Windows
- 01To view it: double-click, or drag it onto any browser window.
- 02To edit it: right-click, choose "Open with", then Notepad, VS Code or Notepad++.
- 03In a browser you can also press Ctrl+U to see the source of the page you are viewing.
- 04If images and layout are missing, look for a folder next to the file with the same name and an "_files" suffix. The page needs it.
macOS
- 01Double-click to open it in Safari, or drag it onto Chrome or Firefox.
- 02To edit, right-click, choose Open With, then TextEdit, and set Format to Plain Text so it does not save styled text.
- 03In Terminal, "open -a Safari file.html" opens it in a specific browser.
What usually goes wrong
TextEdit can silently ruin an HTML file
In its default rich-text mode, TextEdit renders the HTML instead of showing the code, and saving turns it into an RTF document. Choose Format, Make Plain Text before editing anything.
Programs that open .html
Our pick, in order. Every one links to the publisher's official download URL and the SHA-256 hash of the installer. Once you have downloaded it, you can check the file against our index before you run it.
If you end up downloading one of these from somewhere other than the publisher, what you can and cannot verify about that is worth two minutes.
- Sublime Text 4Sublime is a sophisticated cross-platform text editor for code, markup and prose.v4.0.0.420000 · 2 hashed installers92
- Microsoft Visual Studio CodeMicrosoft Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Microsoft Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.v1.132.0 · 4 hashed installers100
- VivaldiPowerful, Personal and Private web browser.v8.1.4087.64 · 3 hashed installers100
Also registers .html in its manifest
Taken straight from publisher manifests. Some of these handle the format for a narrow purpose rather than as their main job.
- Google Chromev151.0.7922.138 · 3 hashed installers100
- Microsoft Edgev151.0.4129.78 · 3 hashed installers100
- Mozilla Firefox (en-US)v153.0.3 · 3 hashed installers100
- Opera GX Stablev134.0.5954.67 · 2 hashed installers100
- Opera Stablev134.0.5954.46 · 3 hashed installers100
- Tor Browserv15.0.19 · 2 hashed installers100
- Waterfoxv6.6.17 · 1 hashed installer100
- Yandex Browserv26.8.0.1788 · 1 hashed installer100
- Bravev151.1.93.136 · 6 hashed installers95
- ONLYOFFICE Desktop Editorsv9.4.0 · 3 hashed installers95
Common questions
- How do I open an HTML file in a browser?
- Double-click it, or drag the file onto an open browser window. You can also use File, Open File from the browser menu and pick the file from disk.
- Why does my saved web page have no images or formatting?
- The page saved its assets into a separate folder named after the file with an "_files" suffix. Without that folder next to the .html, only the bare text loads. Keep both together or save as a single-file archive instead.