HTML Runner

Write or paste HTML with its CSS and JavaScript, press Run and see the result beside the code in a sealed frame in your browser: nothing you write leaves your device.

How to run HTML code

  1. Write or paste your code

    The page opens in Split, with a short example in the editor. Replace it with your own HTML, with CSS in a <style> element and JavaScript in a <script> element, or open an HTML file, a folder or a ZIP with Choose a file or Choose a folder.

  2. Press Run

    Choose Run. The page runs with its scripts in a sealed frame beside the code. Turn scripts off stops them.

  3. Edit and test

    After the first run, each change runs again as you type. Choose Phone 390, Tablet 768, Desktop 1280 or Full to test the layout at that width, or Full screen to show the editor and the result on your whole screen.

  4. Keep your work

    Nothing is saved for you. Choose Copy code or Download HTML before you close the tab.

To open a file someone sent you with its scripts off, use the HTML viewer. How the sealed frame keeps code away from the internet and this site: how htmlviewer.app works.

Run HTML, CSS and JavaScript online

An HTML page holds its own styles and scripts, so one editor is enough: write the HTML, add CSS in a <style> element and JavaScript in a <script> element, and the result shows the three working together. There are no separate HTML, CSS and JavaScript boxes to keep in step.

The code runs in your browser. No server runs or stores it, nothing is installed, and there is no account.

Test HTML at phone, tablet and desktop widths

Under Preview width, Phone 390, Tablet 768 and Desktop 1280 set the frame to that many pixels, and Full fits it to the viewer. The page's media queries respond to that width, so you can check a responsive layout without resizing the window.

The line at the bottom of the viewer checks the page as well: how many scripts it has, which hosts its web addresses point to, and which local files it asks for that are missing.

An HTML sandbox for code you did not write

The sealed frame runs the page with no access to the network. Requests made with fetch, images from the web, form submissions and pop-up windows are refused, and so is loading another site in the frame. The code cannot read this site or your other tabs: reading parent.document throws an error. So you can run a snippet from a forum, or a file from someone you do not know, and see what it does.

If the code needs files from the web (a script library or fonts from a CDN), choose Load remote files. The button appears when the page names a web address: in a script or stylesheet tag, an image, media or written out in its scripts. An address that a script puts together while it runs is added once the script tries it and the sealed frame blocks it. With remote files on, the page loads those files, and its scripts can contact the internet as they could in any browser tab.

Links that leave the page do nothing in the sealed frame, and the line at the bottom of the viewer says so. A script can still move the frame to another address on htmlviewer.app, which shows nothing of your page: Reload preview brings the page back.

HTML compiler, playground or online editor

Many people search for an HTML compiler, but HTML is not compiled: the browser reads the code as it is. What those searches look for is what this page offers, an editor with a live result, often called a playground.

It is a one-page editor. It does not save projects, make share links or load a live site by its address, because each of those needs a server that stores your code. It has no console panel, so what console.log writes does not appear on the page.

Run an HTML file with its own scripts and styles

To run a page saved on your device, add its folder or a ZIP of it, not only the HTML file. Its local stylesheets, scripts, images and fonts are written into the page before it runs, so relative addresses such as js/app.js in its tags work inside the sealed frame. The line at the bottom of the viewer names any file the page asks for that is missing.

Only files named in the page's tags and stylesheets are written in. A file that a script requests while it runs, with fetch or an import, is not available, so a browser game that loads its own files from a script will not find them. To open a saved file in a browser or on a phone without this site, see how to open an HTML file.

Frequently asked questions

How do I run HTML code?

Paste it into the editor on this page and choose Run. The result appears beside the code. Without a site, save the code in a file ending in .html and open it in a browser: Chrome and Edge open a file from your computer with Ctrl+O (Command+O on a Mac).

How do I test HTML code online?

Paste the code here and choose Run. Then set the width to Phone 390, Tablet 768 or Desktop 1280 to check the layout, and read the line at the bottom of the viewer for missing files and remote files.

Can you run HTML on Notepad?

Notepad opens an HTML file as text, so you can write and edit the code there, but it shows the code, not the page. To see the page, open the file in a browser, or paste the code here and choose Run.

What is the best HTML preview editor?

It depends on the job. For a project with many files, a code editor on your computer suits better. For a snippet, a quick test or a file someone sent you, an editor in the browser is quicker: this one needs no install or account, keeps your code on your device and runs scripts only in a sealed frame.

How do I open HTML games on iPhone?

Open this page in Safari, tap Choose a file and pick the game's HTML file, or a ZIP of its folder if it has other files, then tap Run. A game that loads files from the web also needs Load remote files, and a game whose scripts load its own files while it runs will not find them. The runner has not been tested on an iPhone yet.

Can the code reach the internet?

Not unless you allow it. In the sealed frame, network requests, forms, pop-ups and loading another site are refused. If you choose Load remote files, the page's scripts can contact the internet like any web page.

Is my code uploaded or saved?

Neither. The code stays in the page's memory on your device and is gone when you close or reload the tab. The site counts visits with Google Analytics, which never receives your code or your files, and it has no session recording.