JavaScript Playground Online — Run JS Code Instantly

TryJS is a free, fast JavaScript playground and TypeScript playground that runs entirely in your browser. Write and run JavaScript online and see results instantly — no signup, no backend, no installation required. Whether you want to learn JavaScript, experiment with TypeScript, test a quick idea, or share a runnable code example, TryJS gives you a fast and distraction-free JS sandbox to do it.

Write and Run JavaScript Online Instantly

Switch between JavaScript and TypeScript with one click in this online JavaScript editor. TypeScript is transpiled in-browser using Sucrase, so there is zero server round-trip. The editor auto-runs your code as you type with a smart debounce, and you can trigger immediate execution with Cmd+Enter. The built-in console displays logs, warnings, errors, tables, timing output, and REPL-style expression results — just like Chrome DevTools.

NPM Imports in the Browser

Import any npm package by writing a standard import statement such as import confetti from "canvas-confetti". TryJS rewrites bare specifiers to esm.sh and loads modules on the fly. No node_modules, no bundler configuration — just import and use. See it in action on the features page.

Web Playground

Switch to Web Playground mode to write HTML, CSS, and JavaScript in a tabbed editor with live preview. Build and prototype web pages directly in the browser without any extra setup. The preview updates as you type, and a built-in console captures script output and errors.

Snippets, Sharing & Export

Browse the curated snippet gallery covering JS fundamentals, async patterns, and TypeScript essentials. Share your code as a compact URL that preserves editor state, or embed the playground as an iframe in blog posts and documentation. You can also export your code as a styled PNG image with syntax-highlighted themes, window frames, adjustable padding, and gradient backgrounds — perfect for social media and presentations.

Regex Playground

Test regular expressions in real-time with the Regex Playground. Write a pattern, paste your test string, and see matches highlighted instantly. Toggle flags (g, i, m, s, u, d), inspect capture groups and match indices, and use "Explain" mode to break down any regex into human-readable steps. Browse a curated library of common regex patterns including email validation, URL matching, phone numbers, IP addresses, and more.

Customization & Themes

Choose from six syntax themes including One Dark, Dracula, GitHub Light, Monokai, and Solarized Dark. Pick your preferred editor font from Geist Mono, Fira Code, or JetBrains Mono. The resizable split pane lets you control how much space the editor and console each occupy. Code is saved to localStorage per language so you never lose your work.

Safe, Private & Open Source

All code execution happens inside a sandboxed iframe with a five-second timeout to prevent runaway scripts. No code is ever sent to a server. TryJS works on desktop and mobile with a responsive, streamlined interface optimized for speed.

TryJS is open source under the MIT license. View the source code on GitHub, explore all capabilities on the features page, or start coding now at tryjs.app.

Frequently Asked Questions

What is TryJS?

TryJS is a free online JavaScript playground that lets you write and run JS and TypeScript code directly in your browser. No signup, no installation — just open and code.

Can I use npm packages in TryJS?

Yes. Write a standard import statement like import confetti from "canvas-confetti" and TryJS automatically loads the package via esm.sh. No node_modules or bundler config needed.

Is TryJS free?

Yes, TryJS is completely free and open source. All code runs locally in your browser with no server-side processing.

Does TryJS support TypeScript?

Yes. Switch between JavaScript and TypeScript with one click. TypeScript is transpiled in-browser using Sucrase with zero server round-trip.

How do I share my code?

TryJS generates shareable URLs that preserve your editor state. You can also embed the playground as an iframe or export code as a styled PNG.