TSX Minifier - Minify TypeScript React TSX Code for Production Builds
Loading TSX Minifier...
How to Minify TSX/TypeScript React Code - Step by Step Guide
Input Your TSX/TypeScript React Code
Let's get your TSX code into the minifier! Whether you're optimizing TypeScript React components for production, reducing bundle size, or preparing code for deployment, you have several convenient options:
Automatic Minification & Optimization
A moment after you stop typing, the code is parsed with Babel's TypeScript + JSX parser and printed back in compact form:
Download or Copy Result
The badge next to "Minified Output" shows how much smaller the code got. From there:
Frequently Asked Questions
Why minify TSX code?
Mostly to see how small a component gets once comments and indentation are gone, to paste a compact snippet somewhere with a size limit, or to send a component around without the noise. For a real production build your bundler already does this (and more), so think of this page as a quick manual tool rather than a build step.
Does minification break TypeScript types?
It shouldn't. The code is parsed with Babel's TypeScript and JSX parser and printed back compactly, so interfaces, generics, type annotations, enums and as / satisfies casts all stay in place. Strings, template literals, regular expressions and numbers are written exactly as you typed them. If the parser can't read your code, you get an error with the line and column instead of a half-minified file.
What gets removed during minification?
Comments, indentation, line breaks and the spaces around operators, brackets and type annotations. JSX text is tidied the same way React reads it: whitespace that touches a line break disappears and text split across lines is joined with one space, so what renders doesn't change. A few comments are kept on purpose: /*! license banners, @license and @preserve, /// <reference> lines, @jsx pragmas and @ts-ignore / @ts-expect-error hints. Variable and function names are never shortened.
Can I minify TypeScript interfaces and generics?
Yes. Interfaces, type aliases, generics (including the <T,> form arrow functions need in .tsx files), enums, classes (decorators included), declare blocks and import type all go through the parser and come out intact, just without the spacing.
How much smaller will my TSX code be?
It depends on how much of your file is comments and indentation. The sample component on this page goes from about 1 KB to 620 bytes, a little under 40% smaller. Code that is already tight shrinks much less, because names are kept as they are. The badge above the output shows the exact percentage, and on a desktop you can hover it to see the size before and after.
Should I use this for production?
For production builds, use your bundler (Vite, webpack, Rollup or Next.js) with a real minifier such as esbuild, Terser or SWC. They also rename variables, drop dead code and split bundles. This page is handy for testing, quick one-off minification, or checking what a component looks like without comments and formatting.
Related Tools
TSX Formatter
Format and beautify TSX/TypeScript React code with proper indentation
TSX Fixer
Fix broken TSX automatically, repair TypeScript React component errors, type annotations, and JSX syntax
HTML to TSX Converter
Convert HTML to TSX/TypeScript React format instantly
Markdown to TSX Converter
Convert Markdown to TypeScript React TSX components for type-safe content
TSX Validator
Validate TSX syntax and TypeScript React component structure
TSX to JSX Converter
Convert TypeScript TSX to plain JSX
TSX to HTML Converter
Convert React TypeScript TSX to standard HTML
TSX to JavaScript
Convert TypeScript JSX to React.createElement calls