Embed this tool on your site
<iframe src="https://devtoolbox.dedyn.io/tools/javascript-runner" width="100%" height="700" frameborder="0" title="JavaScript Runner"></iframe>

JavaScript Runner

Run JavaScript code instantly in your browser. Supports ES6+, async/await, console output, error handling, and more. Your code runs in a sandboxed iframe and is never sent to any server.

Ctrl+Enter to run
editor.js 0 chars
1
Console 0 logs
Console output will appear here after you run your code.
Ready

Online JavaScript Code Playground

This JavaScript runner lets you write, test, and debug JavaScript code directly in your browser. No installation, no signup, no configuration. Just write code and hit Run. The code executes in a sandboxed iframe, keeping your page safe while giving you full access to modern JavaScript features.

Features

How It Works

When you click Run, your code is wrapped in a try/catch block and injected into a sandboxed iframe. The iframe's console methods are overridden to capture output and send it back to the main page via postMessage. This approach gives you real console output while keeping the sandbox fully isolated.

For async code, the runner wraps your script in an async IIFE, so you can use await at the top level. The sandbox waits for all promises to resolve and reports any unhandled rejections.

Use Cases

Frequently Asked Questions

Is it safe to run JavaScript code online?
Yes. This JavaScript runner executes code inside a sandboxed iframe with no access to the parent page, your cookies, or local storage. The sandbox runs entirely in your browser, so your code is never sent to any server. It is safe for testing and learning.
Does the JavaScript runner support async/await and ES6+ features?
Yes. The runner supports all modern JavaScript features your browser supports, including async/await, arrow functions, destructuring, template literals, classes, optional chaining, and nullish coalescing. Code runs in your browser's native JavaScript engine.
Can I use fetch() or make API calls from the JavaScript runner?
Yes, you can use fetch() and other Web APIs. The sandboxed iframe allows network requests, so you can test API calls, parse JSON responses, and work with async data fetching. CORS restrictions still apply as they would in any browser environment.
Keyboard Shortcuts
Ctrl+Enter Run code
Ctrl+Shift+C Copy output
Ctrl+L Clear console