Swelıty
Tools for everyone

Free Online Node.js Playground

Run Node-style JavaScript in your browser with require, process and Buffer, and see everything you log in a console. No install needed.

Press Run, or Ctrl or Cmd + Enter, to run your code. Everything you log shows in Console. This is Node-style JavaScript running in your browser, not Node itself: require works for util, events, path, assert, os, timers and buffer, process and Buffer are available, and there is no file system, network server or npm.

main.js

Preview

Console

Output appears here. Press Run, then try console.log("Hello")

How to use

  1. Write your code in the main.js tab and use require to load the modules that are available.

  2. Press Run, or Ctrl or Cmd + Enter. Everything you log appears in the Console panel.

  3. Call process.exit to end a run early, or press Stop if your code never finishes.

  4. Copy the code, download a zip of your files or clear the editor with the icons above it.

  5. Open the full screen editor for more room, and use the A buttons to resize the text.

  6. Press Format to tidy the code, or untick Wrap long lines to scroll sideways instead.

Why use this tool

  • Node-style globals

    require, module, exports, process, Buffer, global and the timers, as in a Node script.

  • Everyday built-in modules

    util, events, path, assert, os, timers and buffer, written to follow Node's behaviour for common use.

  • Built-in console

    Output from console.log, plus warnings and errors, appears beside the preview.

  • Isolated preview

    Your code runs in an isolated frame, so it cannot reach this site or your other tabs.

  • Comfortable editor

    Resize the text, switch line wrapping on or off, or go full screen with the editor and preview side by side.

About this tool

Run Node-style JavaScript in your browser, with nothing to install. This Node.js playground supplies the parts of Node that do not need an operating system: require for util, events, path, assert, os, timers and buffer, plus process, Buffer and the usual timers. Use it to practise the CommonJS style, try EventEmitter, path and util.promisify, or check a function with assert. It is not Node itself, so there is no file system, no network server, no child processes and no npm. Asking for one of those modules gives a clear message instead of a crash.

Frequently asked questions

No. It is JavaScript running in your browser with a small stand-in for the parts of Node that do not need an operating system. Code that uses the file system, network servers or npm packages will not work here.

util, events, path, assert, os, timers, timers/promises and buffer, with or without the node: prefix. Any other module shows a message saying it is not available.

No. For a library, use the JavaScript Playground and load a script from a public https address.

Write in the CommonJS style with require. To use await, wrap it in an async function and call that function, as the example does.

No. Nothing is loaded from another site.

Yes. Untick Wrap long lines under the editor and it scrolls sideways instead. Your choice is remembered on this device.