JavaScript Compiler Online
Run JavaScript online in your browser, with nothing to install. This JavaScript online compiler runs your code when you press Run, and the console shows the output and any errors. Sign in to save your code and share a link. It’s part of Playcode Classic, Playcode’s free code tools.
Free. No account needed to start.

See what your code prints the moment you press Run
console.log, warn, error and info land in the console in order. An error shows its message and stack trace, so you know where to look.

Catch mistakes before you run
The JavaScript editor suggests names and methods as you type, with the documentation beside them. A mistyped line is underlined before it becomes an error.

Stuck? Ask the AI
The editor’s AI chat can write a function, explain a line or fix an error. It uses credits; eligible new accounts get trial credits.

Watch it run
A minute in the editor: write code, take a suggestion, run it and read the console.
JavaScript examples to try
const items = [
{ name: 'Tea', price: 4 },
{ name: 'Cake', price: 6.5 },
]
const total = items.reduce(
(sum, item) =>
sum + item.price,
0,
)
console.log(total) // 10.5const wait = (ms) =>
new Promise((resolve) =>
setTimeout(resolve, ms),
)
async function main() {
await wait(500)
console.log(
'Done after half a second',
)
}
main()const people = [
'Zoe', 'adam', 'Émile',
]
people.sort((a, b) =>
a.localeCompare(b),
)
console.log(people)
// ['adam', 'Émile', 'Zoe']Part of Playcode Classic
Playcode began in 2016 as a browser coding environment. This compiler is one of its free code tools, which we now call Playcode Classic.
Playcode today is an AI platform for building and running websites and apps.

Questions people ask
Is this JavaScript compiler free?
Yes. Running code is free and needs no account. Saving and sharing need a free account, which keeps up to three saved projects, public or private.
How do I run JavaScript online?
Open the compiler, write or paste your code and press Run. The console shows what it prints, and any error with its stack trace. You can run JS online from a phone as well.
Is it a JS compiler or a JavaScript runner?
Both names fit. JavaScript is not compiled ahead of time like C: your browser’s engine compiles and runs it as it goes. This JavaScript code runner hands your code to that engine and shows what it prints, which is what most people mean by a JS compiler.
Do I need to install anything?
No. It runs in your browser, on a computer or a phone.
Can I use npm packages?
Yes. Import a package and the editor offers to install it from npm.
Does it support TypeScript and JSX?
The editor compiles both as you type. For TypeScript on its own, try the TypeScript playground.
Can I build an HTML page, not only print to the console?
Yes. Open the JavaScript playground to write HTML, CSS and JavaScript and see the page in a live preview.
Is my code private?
Your code runs in your browser. Projects you save are stored on Playcode. A project you create while signed in starts private on every plan; one you started before signing in stays public until you turn its link off.
How is this different from the JavaScript playground?
Use the online JavaScript compiler to run a snippet and read its output. Use the playground to build something with HTML, CSS and packages and see it in a live preview.
Is this compiler part of Playcode?
Yes. This compiler is part of Playcode Classic, Playcode’s free code tools. Playcode began in 2016 as a browser coding environment. Today it is an AI platform for building and running websites and apps.
More free code tools
- JavaScript Playground
HTML, CSS and JavaScript with a live preview.
- JavaScript Sandbox
Try a snippet in isolation.
- JavaScript REPL
Type an expression, see the result.
- TypeScript Playground
Types checked as you write.
- HTML Editor
Build a page and see it live.
- React Playground
Components with a live preview.
- JSON Formatter
Tidy and check JSON.
- Regex Tester
Test a pattern against your text.
Run your first line.
