HTML editor
Type your markup, styles and script in separate boxes. The preview below runs them in an isolated frame and refreshes shortly after you stop typing. Your code is kept in this browser.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Write markup in the HTML box (only what goes inside the body), styles in CSS and script in JavaScript.
- Watch the preview, or press Run to refresh it at once.
- Press Download .html to save everything as one file.
How it works
The three boxes are combined into one document and shown through the frame’s srcdoc, with only allow-scripts in its sandbox. A closing style or script tag inside your CSS or script is escaped so it cannot end its block early.
Example
With the starting code, pressing the button in the preview writes “Clicked!” under it.
Tips
- Use the Reset button to return to the example.
- Add a viewport meta tag yourself if you edit the downloaded file for phones; the generated page includes one.
Frequently asked questions
Is it safe to run code I paste here?
The preview is a sandboxed frame with scripts allowed but without access to this site, its cookies or its storage. The frame can still do what any web page does, such as loading outside images, so paste code you trust.
What does the downloaded file contain?
One complete HTML page: your CSS in a style block in the head, your HTML in the body and your JavaScript in a script block at the end of the body.
Why is my script not running?
The frame has no console here, so check the script for typos. Scripts run once after the HTML, so elements must exist in the HTML box before the script looks for them.
Is my code saved?
Yes, in this browser's local storage, a moment after you stop typing. It is not uploaded. Download the file to keep a copy elsewhere.