TypeScript Minifier - Minify TypeScript/JSX Online

Minify and compress your TypeScript or TSX/JSX code instantly using our free online tool. Reduce file size, clean up formatting, and optimize scripts for faster load times and better performance.

Tags: compress code javascript minify code minify tsx typescript

🚀 146,689 total conversions (10 this month)

Practice Python with coding challenges

Solve hands-on problems right in this editor: run the sample tests, submit, and get an AI code review.

All Python challenges
Easy

Dot Product of Two Vectors

Multiply two vectors element by element and add the results: the core operation of every neuron.

You'll learn VectorsDot product
Neural networksaimachine learning
Easy

Distance Between Points

Compute the straight-line distance between two points.

You'll learn Pythagorean theoremSquare roots
BeginnerFunctionsLearning-pathmath
Easy

Count Pairs With a Sum

Count pairs of positions whose values add up to a target.

You'll learn Pairs of indexesAvoiding double counts
ArraysBeginnerLearning-pathNested-loops
Easy

Average of Three

Average three whole numbers.

You'll learn ArithmeticDivision
BeginnerLearning-pathVariables
Easy

Rectangle Perimeter

Compute the perimeter of a rectangle from its sides.

You'll learn ArithmeticReturn values
BeginnerLearning-pathVariables
Easy

Join Customers and Orders

Join customers with their orders like a LINQ Join and report each customer's total spend.

You'll learn LINQ JoinGrouping
ArraysSorting
No solutions yet
Easy

To-Do List

Keep a list of tasks: add them, mark them done, remove them and report what is still pending.

You'll learn Typed collectionsRecords
BeginnerSimulationStrings
No solutions yet
Easy

Linked List Operations

Simulate a linked list: add at either end, remove from the front or by value, and reverse it.

You'll learn Linked listsSimulation
Data-structuresSimulation
No solutions yet
Easy

Sum a Flat JSON Object

Parse a flat JSON object whose values are integers and add up the values.

You'll learn JSON parsingString splitting
ParsingStrings
No solutions yet
Easy

WhenAll Total Time

Find how long a program takes when each group of tasks runs together with Task.WhenAll and groups run one after another.

You'll learn Async/awaitTask.WhenAll
ArraysBeginner
No solutions yet
Medium

Parallel Task Completion Order

Run tasks concurrently with at most k at a time and report the order in which they finish.

You'll learn ConcurrencyPriority queues
SimulationSorting
No solutions yet
Medium

Min Stack

Build a stack that reports its smallest element instantly after any push or pop.

You'll learn StacksRunning minimum
Data-structuresStacks
No solutions yet

Introduction

This online TypeScript minifier tool helps you compress and optimize your TypeScript code effortlessly. It’s perfect for reducing file size, improving performance, and streamlining your scripts for production environments.

How to Use This Tool

  1. Paste your TypeScript code directly into the editor or type it in.
  2. Click the Minify button to compress your TypeScript code.
  3. After minifying, you can:
    • Download the optimized result.
    • Save or share it using a unique link.
    • Sign in with Google or GitHub to save your minified code for future use.

What is TypeScript?

TypeScript is a strongly-typed programming language that extends JavaScript with optional static types. It’s a syntactical superset of JavaScript, meaning any valid JavaScript code is also valid TypeScript code.

By adding features like static typing, interfaces, and advanced tooling, TypeScript helps developers write more reliable, maintainable, and scalable code. It’s widely used in modern web development, especially for large-scale applications.

Learn more about TypeScript from the official TypeScript documentation .

TypeScript Syntax

      
// TypeScript program to solve a quadratic equation
let root1: number, root2: number;

// Take input from the user
const a: number = parseFloat(prompt("Enter the first number: "));
const b: number = parseFloat(prompt("Enter the second number: "));
const c: number = parseFloat(prompt("Enter the third number: "));

// Calculate discriminant
const discriminant = b * b - 4 * a * c;

// Condition for real and different roots
if (discriminant > 0) {
    root1 = (-b + Math.sqrt(discriminant)) / (2 * a);
    root2 = (-b - Math.sqrt(discriminant)) / (2 * a);

    // Result
    console.log(`The roots of the quadratic equation are ${root1} and ${root2}`);
}

// Condition for real and equal roots
else if (discriminant === 0) {
    root1 = root2 = -b / (2 * a);

    // Result
    console.log(`The roots of the quadratic equation are ${root1} and ${root2}`);
}

// If roots are not real
else {
    const realPart = (-b / (2 * a)).toFixed(2);
    const imagPart = (Math.sqrt(-discriminant) / (2 * a)).toFixed(2);

    // Result
    console.log(
    `The roots of the quadratic equation are ${realPart} + ${imagPart}i and ${realPart} - ${imagPart}i`
  );
}
      
    

What is Minification?

Minification is the process of minimizing code and markup in your web pages and script files. It’s one of the main methods used to reduce load times and bandwidth usage on websites. Minification dramatically improves site speed and accessibility, directly translating into a better user experience. It’s also beneficial to users accessing your website through a limited data plan who would like to save on their bandwidth usage while surfing the web.

Why minify TypeScript?

When creating TypeScript, developers often use spacing, comments, and well-named variables to make code readable for themselves and others who might later work on the codebase. While this is beneficial during development, it becomes a disadvantage when serving your web pages. Web servers and browsers can parse file content without comments and well-structured code, both of which create additional network traffic without providing any functional benefit.

To minify TypeScript files, comments and extra spaces need to be removed, and variable names should be shortened to minimize code and reduce file size. The minified file version provides the same functionality while reducing the bandwidth of network requests.

Examples

Before minified

      
// TypeScript program to find the HCF or GCD of two integers

let hcf: number;
// Take input
const number1: number = parseInt(prompt('Enter a first positive integer: '));
const number2: number = parseInt(prompt('Enter a second positive integer: '));

// Looping from 1 to number1 and number2
for (let i = 1; i <= number1 && i <= number2; i++) {

    // Check if i is a factor of both integers
    if( number1 % i === 0 && number2 % i === 0) {
        hcf = i;
    }
}

// Display the HCF
console.log(`HCF of ${number1} and ${number2} is ${hcf}.`);
      
    

After minified

      
let hcf:number;const number1:number=parseInt(prompt('Enter a first positive integer: '));const number2:number=parseInt(prompt('Enter a second positive integer: '));for(let i=1;i<=number1&&i<=number2;i++){if(number1%i===0&&number2%i===0){hcf=i}}console.log(`HCF of ${number1} and ${number2} is ${hcf}.`);