How to use
- Pick HTML, CSS or JavaScript with the tabs above the editor and type your code. A click-counter example is filled in to start.
- With Run as you type on, the preview on the right refreshes within 0.6 seconds after you stop typing. Turn it off to update only when you press Run.
console.logoutput and errors collect in the Console under the preview. JavaScript errors also tell you which line of your code caused them.- When you are happy, use Download as HTML file to save everything as one
index.html, or Copy full HTML to take it elsewhere.
How it runs safely
Your code never runs inside this page. It runs only in an isolated frame (iframe) that carries a single sandbox flag, sandbox="allow-scripts", so scripts work while the frame stays separate from this site. This is what happens when code tries various things.
| Attempt | Result |
|---|---|
console.log, DOM changes, CSS animations, canvas |
Works |
fetch, XMLHttpRequest, external images, fonts, scripts |
Blocked by the content security policy |
<form> submit, navigating away by clicking a link |
Blocked. A link click only leaves a note in the console |
localStorage, document.cookie, reaching the parent page |
Rejected with a security error |
eval, new Function |
Rejected by the site’s policy |
alert, confirm, prompt |
Logged to the console instead (confirm returns false, prompt returns null) |
That means code that loads a library from a CDN (<script src="https://...">) will not work. Paste the code in yourself. This tool is for personal practice and short experiments, not for building apps that talk to outside servers.
Features and limits
- The console separates
log,info,warn,erroranddebug, and turns objects, arrays and circular references into text. It keeps the latest 500 lines. - Unhandled promise rejections and runtime exceptions show up in the console too.
- If HTML, CSS and JavaScript together pass 200,000 characters, nothing is run and you get a notice.
- The downloaded
index.htmlis a clean document without the console-capturing code. - Code with an endless loop such as
while (true)can freeze the preview, and if the browser tab stops responding you have to reload the page. Your code is lost on reload, so copy anything important first.
Good for
- Trying out CSS
transition,animation,flexandgridand seeing the result immediately - Quick JavaScript experiments with array or string methods and event handling
- Building a minimal reproduction to paste into a blog post or a question
Frequently asked questions
Is my code saved on a server?
No. The code runs only in this browser and is never sent to a server. Reloading the page brings back the example, so download or copy your work first if you want to keep it.
Can I use an external library or API?
No. The isolated frame blocks every request that leaves the browser. Put any data directly in your code. Images work if you embed them as data: URLs.
My alert box does not appear.
An isolated frame cannot open pop-up dialogs, so the text of alert is shown in the console as alert: ... instead.
Does it work on a phone?
Yes. On a narrow screen the editor and the preview stack vertically. Typing long code on a small screen is awkward, so it suits quick checks best.
How do I tidy up my code?
Use HTML Beautifier & Minifier, CSS Beautifier & Minifier or JavaScript Beautifier & Minifier to fix indentation. For regular expressions, try the Regex Tester.
Related tools
HTML Beautifier & Minifier | CSS Beautifier & Minifier | JavaScript Beautifier & Minifier | Markdown Preview | Regex Tester
The code you type is processed only in your browser and never sent to a server.