HTML Viewer
Open an HTML file or paste HTML code and see the page in your browser, with its scripts off until you choose to run them: the file stays on your device.
How to view an HTML file
Open the file or paste the code
Drop an HTML or HTM file on the box above, or press Choose a file. To see code you copied, paste it into the box marked Or paste HTML code: it opens as soon as you paste. A page with its own images and stylesheets opens complete when you add its folder (drop it, or press Choose a folder) or a ZIP of it.
Read the page
A file opens in Preview, and pasted code opens in Split, with the code beside the page; Code shows the code alone. Once you choose a layout, the viewer uses it the next time. The line at the bottom of the viewer gives the encoding and the size, and counts the page's scripts, remote files and missing local files.
Run the scripts if you need them
Scripts do not run until you choose Run scripts. They then run in a sealed frame that has no internet access and cannot read this site or your other tabs. Turn scripts off goes back to the script-free preview.
Save, print or copy
Download HTML saves the page as one HTML file with its local images, styles and scripts inside. Print / Save as PDF opens your browser's print dialog for the page alone, and Copy code copies the code in the code pane.
Other ways to open a file, in Chrome, on an iPhone, on Android and on a Mac: how to open an HTML file.
View HTML files without uploading them
Many online HTML viewers call opening a file an upload, and some send the file to their server to show it. This viewer reads the file in your browser, on your own device. The file never leaves it, so the viewer also works with no internet connection once the page has loaded.
You can check this yourself. Load the page, turn off Wi-Fi and open a file. Or open your browser's developer tools and watch the Network tab while you open one: no request carries the file, its name or anything in it. The only requests to another server go to Google Analytics, unless you choose to load the page's remote files or open one of its links. How to check that nothing is uploaded has the steps.
Paste HTML to preview it
Paste HTML code into the box and the rendered page appears beside it. The code pane is an editor: change a tag, a color or a line of text and the preview updates as you type. Choose Code to read the source alone, or Preview to see only the page.
To see how the page fits other screens, choose a Preview width: Desktop 1280, Tablet 768 or Phone 390 set the frame to that many pixels, and Full fits it to the viewer. Full screen shows the viewer, with its toolbar and the page, on your whole screen. To write and run code from scratch, the HTML runner starts with a short example.
Open an HTML file on an iPhone or Android phone
Phones offer no simple way to show a saved HTML file as a page. Apple's iPhone guide says that a file whose app is not installed opens as a Quick Look preview in the Files app, and it documents no way to open a saved HTML file in Safari. Google's Android help says to tap a file in the Files app to open it, and names no app that shows an HTML file as a page.
This viewer is a web page, so a phone's browser can open it. Open htmlviewer.app in Safari or Chrome and tap Choose a file: the file picker is set to HTML, HTM, XHTML, MHT, MHTML and ZIP files. On a narrow screen, Split shows the page and the code as two tabs. A page with images and stylesheets needs its folder: on an iPhone, touch and hold the folder in Files and tap Compress, as Apple's guide describes, then choose the ZIP here. The viewer has not been tested on phones yet.
Run the page's scripts safely
An HTML file can contain JavaScript, and a file you did not write can contain code you would not choose to run. So the viewer shows the page with scripts off: no script, event handler or javascript: link in the file runs. The line at the bottom of the viewer says how many it found.
When you need them, choose Run scripts. The page then runs in a sealed frame, which the browser treats as a separate site with no network access: it cannot read this site, its storage or your other tabs. Network requests, forms and pop-up windows are refused, and so is loading another site in the frame.
Images, fonts and stylesheets that the page loads from the web stay blocked until you choose Load remote files. That button appears when the page names a web address, or when a script that is running tries one and is blocked, and those hosts are listed beside it. With scripts and remote files both on, the page's scripts can contact the internet, as they could in any browser tab.
Open a folder or ZIP with the page's own files
An HTML page often uses other files saved beside it: a stylesheet, images, a font, a script. Opened alone, it shows without them. Drop the whole folder, press Choose a folder or add a ZIP of it, and the viewer finds those files and shows the page with them.
When the folder holds several pages, a page chooser lists them, and links between them work. The line at the bottom of the viewer names any file the page asks for that is not there. Download HTML then saves the page you are viewing as one HTML file with its stylesheets, scripts, images and fonts written into it, which opens without the folder. Files on the web stay as web addresses, and the page's scripts are kept, so they run when you open the downloaded file in a browser.
What is an HTML or HTM file
An HTML file is a web page saved as a file. HTML describes the parts of a page: headings, paragraphs, links, images. In the words of MDN, Mozilla's reference for web developers, other technologies describe "a web page's appearance/presentation (CSS) or functionality/behavior (JavaScript)". Both can be written inside the HTML file or kept in separate files.
HTML and HTM are the same format. The HTML standard names "html" and "htm" as the file extensions commonly used, and Windows lists both as "Hypertext markup language page". This viewer also opens XHTML files and web pages saved as one file in the MHT or MHTML format: see the MHTML viewer.
Frequently asked questions
Is there a free HTML viewer?
Yes. This one is free, needs no account and installs nothing. It opens HTML, HTM, XHTML, MHT and MHTML files, folders and ZIP archives in your browser, and shows pasted code as a page.
How do I open an HTML file on the web?
Open this page and drop the file on the box, or press Choose a file. The page is shown in your browser without being uploaded. To open a file in Chrome itself, Google lists Ctrl+O (Command+O on a Mac), then select the file.
What programs can open an HTML file?
A web browser shows it as a page: Chrome and Microsoft Edge each document Ctrl+O for opening a file from your computer. A text editor shows its code: Microsoft names Notepad among the apps that open any text format. On a phone, this viewer is a web page the browser can open, though it has not been tested on phones yet.
How do I preview my HTML code?
Paste it into the box on this page. The page appears beside the code and updates as you edit. Scripts in the code run when you choose Run scripts.
How can I view HTML code in Chrome?
For a page you have open, Google lists Ctrl+U on Windows and Linux, and Command+Option+U on a Mac, to show its source code. For a file, open it here and choose Code, or Split to see the code beside the page.
How can I open an HTML file on my phone?
Open this page in your phone's browser, tap Choose a file and pick the file from Files or Downloads. It is shown with scripts off until you run them. For a page with images and stylesheets, choose a ZIP of its folder. The viewer has not been tested on phones yet.
Is it safe to open an HTML file?
An HTML file is a web page, so it can carry scripts, links and forms like any page. Here nothing in it runs until you choose Run scripts, and even then it has no internet access unless you also choose Load remote files, and it cannot read this site. A web link in the preview shows its address and opens only when you choose Open link. If a page from a file you did not expect asks for a password or a card number, do not enter it.
Is HTML a programming language?
HTML is a markup language: it describes the parts of a page rather than giving instructions to run. MDN describes it as "a markup language that tells web browsers how to structure the web pages you visit". The programs in a page are written in JavaScript.
Is my file uploaded?
No. The file is read in your browser and never leaves your device. The site counts visits with Google Analytics, which never receives your files, their names or their contents, and it has no session recording.