Most online code editors want an account before they will let you keep anything, and the work then lives on their server rather than your machine. This keeps everything in your browser: the code is saved on this device as you type, a refresh does not lose it, and nothing is ever uploaded.
The preview updates as you pause typing, and console.log output and uncaught errors appear in a panel underneath, which is the part most simple editors leave out. Without it a mistake in your JavaScript is silent, because the preview frame has a console nobody can see.
When you are done there are two ways out. One self-contained .html file with everything inlined, or a .zip with index.html, style.css and script.js kept separate the way a real project is laid out. Both open anywhere, need no build step, and carry no dependency on this site.
How to use it
- 1Pick the HTML, CSS or JS tab and start typing.
- 2The preview updates when you pause. Turn off Run as I type if you are writing a loop.
- 3Watch the console panel for logs and errors.
- 4Download it as one .html file, or as a .zip with the three files kept separate.
Questions
- Is my code uploaded anywhere?
- No. Everything runs in your browser, and your work is saved in this browser's local storage on this device. It is never sent to a server, so there is nothing for us to store, lose or leak.
- Will I lose my work if I close the tab?
- No. It is saved as you type and restored when you come back. It is stored per browser and per device though, so it will not follow you to another machine. Download the file if you need it elsewhere.
- Why does localStorage not work inside the preview?
- The preview runs in a sandboxed frame with no origin of its own, which is what stops pasted code from reading this site's data or calling its API routes as you. Storage and cookies need an origin, so they throw inside the frame. Layout, styling, DOM work and logic all behave normally.
- Can I fetch from an API in the preview?
- Usually not. The frame has a null origin, and most servers refuse cross-origin requests from one. Some public APIs that send a permissive CORS header will work. This is the cost of the sandbox that keeps the tool safe to paste unknown code into.
- Can I add a library like React or jQuery?
- Yes. Put a script tag pointing at a CDN in the HTML pane and it loads normally, since script loading is not restricted.
- The preview froze. What happened?
- Almost certainly an infinite loop. Turn off Run as I type before writing loops, fix the code, then press Run, which rebuilds the frame and clears the stuck one.
- Is there syntax highlighting and autocomplete?
- Yes, from CodeMirror, with bracket matching and Tab indentation. It loads after the page, so there is a plain text box for the first moment, which stays usable if the editor cannot load at all.
- What do the downloads contain?
- There are two. The .html download is a single file with your CSS in a style tag and your JavaScript in a script tag, ready to open anywhere. The .zip download gives you index.html, style.css and script.js as separate files, linked the normal way, which is how you would start a real project. Nothing from this site is included in either, not even the console bridge or the loop guard, so what you get is exactly what you wrote.
Related
The rest of the site is deterministic tools rather than an editor. Browse all of them, or jump to the HTML generators and CSS generators to produce code you can paste straight in here.