Online TypeScript Compiler
Compile and run TypeScript online. Your code is type-checked with the official compiler in strict mode, then runs in a sandboxed worker in your browser.
Runs in your browser · Nothing uploadedFree · No sign-up
Something not working, or missing a feature? Send feedback
About the TypeScript Compiler
The TypeScript Compiler type-checks your code with the official TypeScript compiler in strict mode, reports type errors with their location, then strips the types and runs the result in a sandboxed worker.
Your code runs in an isolated Web Worker in your browser, so it never leaves your device.
How to use the TypeScript Compiler
- Write or paste TypeScript.
- Choose whether type errors should stop the run.
- Click Run: type errors are listed first, with line and column, followed by the program output.
- Click Visualize to step through the program line by line on your original TypeScript lines.
Example
Input
function total(prices: number[]): number {
return prices.reduce((sum, p) => sum + p, 0);
}
const count: number = "3";
console.log(total([1, 2, count]));Result
main.ts(4,7): error TS2322: Type 'string' is not assignable to type 'number'. Found 1 type error. Not running because of type errors (turn off "Stop on type errors" to run anyway).
The error gives the line and column (4,7) and the compiler’s error code, the same format tsc uses.
Common mistakes
- Running with type errors. With "Stop on type errors" off the program runs anyway, and the mistake may only show up as a wrong result. Fix the errors first.
- Expecting npm packages. There is no node_modules folder, so imports of packages such as lodash or zod cannot be resolved. Paste the code you need into the editor.
- Strict null checks. Strict mode is on, so a value that may be undefined (for example the result of array.find) must be checked before use. That is usually the error you want to see.
Works well with the TypeScript Compiler
- JavaScript Compiler: run plain JavaScript without type checking.
- TypeScript Formatter: format the code with Prettier.
- JSON to TypeScript: generate types from a JSON sample.
Frequently asked questions
Does it run code with type errors?
Type errors are always listed. With "Stop on type errors" on, the program does not run; switch it off to run the type-stripped JavaScript anyway.
Which compiler options are used?
Strict mode with a modern target, matching a typical new TypeScript project.
Can I step through TypeScript code?
Yes. Click Visualize: the types are removed (keeping every line where it was), and the program is recorded step by step, so the highlighted line, variables and return values match your TypeScript source. Type checking is skipped while visualizing; use Run to see type errors.
Which TypeScript version is used?
A recent release of the official compiler, loaded in your browser. Type checking runs in a Web Worker so the page stays responsive.
Is my code uploaded?
No. Type checking and running both happen in your browser.
Is TypeScript compiled?
Yes. The TypeScript compiler checks your types and then removes them, producing plain JavaScript that runs like any other script. This tool does both steps in your browser: it reports type errors first, then runs the JavaScript.
Do I need Node.js or npm to run TypeScript?
Not here. The compiler and the runtime both run in your browser, so you can try TypeScript without installing Node.js, npm or ts-node. Packages from npm cannot be imported in the sandbox.
Guides and tutorials
- Programming Languages
TypeScript Strict Mode Explained: Every Flag and the Bugs It Catches
What "strict": true turns on, the real compiler error for each flag, extra checks worth enabling, and a step-by-step plan for migrating an existing codebase.
· 5 min read
- JSON & Data Formats
How to Generate TypeScript Types from JSON API Responses
Turn a JSON sample into TypeScript interfaces, then fix what a generator can't know: nullable fields, optional keys, unions, dates and runtime validation.
· 6 min read
- Programming Languages
The JavaScript Event Loop: Promises, setTimeout and Microtasks in Practice
Why setTimeout(fn, 0) runs after promises, how await pauses, why busy loops delay timers, and how to run async work in sequence or parallel, with tested output.
· 6 min read
Related tools
JavaScript Compiler
Run JavaScript online in an isolated browser sandbox. See console output, errors and execution time instantly, with top-level await and stdin input.
Python Compiler
Run Python 3 code online with the full standard library and stdin input. It runs in your browser with Pyodide (WebAssembly), so your code stays on your device.
PHP Compiler
Run PHP 8.4 code online and see the output instantly, with stdin input and mbstring. PHP runs in your browser with WebAssembly, so your code stays private.
C Compiler
Compile and run C code online with Clang 21, a GCC-compatible compiler: pick C89 (ANSI C), C99, C11, C17 or C23 and add stdin input. Your code stays private.
C++ Compiler
Run C++ code online for free: compile C++20 with Clang 21 and libc++, type stdin input and see the output. It runs in your browser, so your code stays private.
C# Compiler
Run C# code online with Roslyn and .NET 10: C# 14, top-level statements, LINQ, records and Console.ReadLine input, in your browser, so code stays private.