Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

JavaScript Sandbox

Write HTML, CSS, and JavaScript and see live results instantly — like a mini CodePen in your browser

Your files never leave your browser
PreviewReady
Console
Ready·

Write HTML, CSS, and JavaScript in three separate tabs, hit Run (or just keep typing — auto-run fires after 300ms), and watch the live preview update instantly with a built-in console panel for quick debugging. Download the result as a single .html file when you’re done. And everything runs in your browser. Nothing gets uploaded.

How It Works

Write HTML/CSS/JS
→
Inject into iframe
→
Live Preview + Console

Your code from all three tabs gets combined into a single HTML document and injected into a sandboxed iframe using srcdoc. The iframe runs it like a normal web page. A small script wrapper intercepts console.log, console.warn, and console.error calls, then passes them back to the parent page so they show up in the console panel. Auto-run triggers 300ms after you stop typing.

Examples

Quick DOM manipulation test

You want to check if a classList toggle works the way you think it does.

INPUT (JS tab)
const box = document.getElementById('box'); box.addEventListener('click', () => { box.classList.toggle('active'); console.log('Active:', box.classList.contains('active')); });
CONSOLE OUTPUT
> Active: true > Active: false > Active: true

CSS animation prototyping

Testing a bounce-in keyframe animation before dropping it into a real project. Write the HTML in one tab, the CSS in another, and instantly see the result.

INPUT (CSS tab)
@keyframes bounceIn { 0% { transform: scale(0.3); opacity: 0; } 50% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } } .card { animation: bounceIn 0.6s ease-out; }
PREVIEW
A card element that bounces into view with a smooth scale + fade animation. Tweak the percentages and see changes instantly.

Fetch API response debugging

Checking what an API actually returns before building the UI around it.

INPUT (JS tab)
fetch('https://jsonplaceholder.typicode.com/posts/1') .then(r => r.json()) .then(data => { console.log('Title:', data.title); console.log('Body length:', data.body.length); });
CONSOLE OUTPUT
> Title: sunt aut facere repellat provident occaecati excepturi optio reprehenderit > Body length: 292

Who Uses This

👨‍💻 Frontend Developers

Testing a CSS trick or debugging a DOM issue without spinning up a whole dev server.

🎓 Students

Working through homework exercises or following along with a JavaScript tutorial in real time.

📝 Technical Writers

Verifying code snippets actually work before putting them in documentation or blog posts.

🎨 Designers

Prototyping a hover effect or animation without asking a developer to set up a branch.

Common Mistakes

Putting a <script> tag in the HTML pane instead of the JS pane

Your JavaScript runs twice — once from the script tag, once from the JS pane injection. Move all JS code to the JS tab and keep HTML for markup only.

Referencing a DOM element before it exists

The JS pane code runs at the end of the body, so elements from the HTML pane should already exist. But if you’re dynamically creating elements in JS and then immediately querying them, add a short setTimeout or use event listeners.

Infinite loops freezing the preview

A while(true) or runaway recursion will lock up the iframe. The sandbox can’t stop it once it starts. If the preview goes blank or unresponsive, hit “Clear All” and fix your loop condition before running again.

Technical Details

Frequently Asked Questions

Can I use React, Vue, or other frameworks in this sandbox?

Yes, but you’ll need to load them via CDN. Add a script tag like <script src="https://unpkg.com/react@18/umd/react.production.min.js"></script> in your HTML pane. JSX won’t work without a transpiler though — you’d need to include Babel standalone too, which gets heavy. For quick experiments it is fine, but for anything serious a dedicated React playground would be better.

Is my code saved if I close the tab?

No. This sandbox doesn’t use localStorage or any persistence. Close the tab and your code is gone. If you want to keep your work, click “Download HTML” before leaving. That gives you a standalone file you can reopen in any browser.

Why does my console.log not show up?

The console capture only works for code running inside the preview iframe. If your script throws an error before reaching the console.log call, it won’t appear. Check for syntax errors first. Also, console.log inside a setTimeout or async function will show up — but only after that code actually executes.

How is this different from CodePen or JSFiddle?

Those are full platforms with accounts, sharing, and community features. This is a single-page tool that runs entirely in your browser. No signup, no server, no tracking. It’s faster to open and use when you just need to test something quick. The tradeoff is you don’t get saved projects or collaboration.

Can I access APIs and fetch external data?

Absolutely. The preview iframe has normal network access, so fetch() and XMLHttpRequest work as expected. The only catch is CORS — if the API you’re calling doesn’t allow cross-origin requests from a null origin, it’ll fail. Most public APIs like JSONPlaceholder or OpenWeather work fine.

Share:
\n\n'+html+'\n