Quick answerDouble-click the .html file to open it in your default web browser (Windows and Mac), or drag it into any browser window. On Android or iPhone, open htmlonline.dev/html-viewer/ in your browser and tap Open file. To see or edit the code, open it in a text editor or the online HTML editor.
Windows
- Open File Explorer and find the file (it may show as a browser icon, type "HTML Document" or "Chrome HTML Document").
- Double-click it — it opens in your default browser.
- To choose another browser: right-click → Open with → pick Chrome, Edge or Firefox.
- To see the code: right-click → Open with → Notepad (or VS Code), or press Ctrl+U in the browser to view source.
Mac
- In Finder, double-click the file to open it in Safari (or your default browser).
- Right-click → Open With to pick Chrome or Firefox.
- To see the code: right-click → Open With → TextEdit. In TextEdit settings, tick "Display HTML files as HTML code instead of formatted text" or it will render the page instead.
Android
Many Android file managers and email apps show HTML as text or say "no app can open this file". The easiest fix:
- Open Chrome and go to htmlonline.dev/html-viewer/.
- Tap Open file and choose the file from Downloads, Drive or your file manager.
- The page renders instantly. Tap Full screen to see it on its own.
Some file managers also offer Open with → Chrome; recent Android versions often block this for security, which is why the viewer is more reliable.
iPhone and iPad
The Files app previews .html files as plain code. To see the page:
- Open Safari and go to htmlonline.dev/html-viewer/.
- Tap Open file → Browse and pick the file from Files, iCloud Drive or Downloads.
- The page appears in the preview pane.
Why does my HTML file open as text?
Three common reasons: the app you used (email, file manager, Files app, TextEdit) shows source by default; the file was saved with the wrong extension, such as page.html.txt (turn on "show file extensions" to check); or the file was served with a text/plain content type. Opening it in a browser or the HTML viewer fixes the first two.
Why are images or styles missing?
An HTML file often references other files — images/logo.png, style.css — by relative path. If you only have the .html file (for example, from an email attachment), those files aren't there, so the page looks plain. Ask for the whole folder or a .zip, keep the folder structure, and open the .html from inside it.
Editing the file
Any plain-text editor can edit HTML. For a live preview while you type, open the file in the online HTML editor, make changes, and press Save to download the updated file.
Frequently asked questions
What program opens HTML files?
Any web browser (Chrome, Edge, Safari, Firefox) displays them as pages; any text editor (Notepad, TextEdit, VS Code) shows the code.
How do I open an HTML file on my phone?
Open htmlonline.dev/html-viewer/ in your phone's browser and tap Open file. It works on Android and iPhone without installing an app.
Is it safe to open an HTML file from an email?
HTML attachments are a common phishing trick — they can show fake login pages. Don't enter passwords into a page opened from a file. Viewing it in a sandboxed viewer is safer than opening it directly.
What's the difference between .htm and .html?
None. .htm is an older three-letter form of the same extension.
How do I convert an HTML file to PDF?
Open it in the HTML to PDF converter and save it as a PDF from the print dialog.