Web Tools
JavaScript Minifier
Minify JavaScript and TypeScript code by removing comments, collapsing whitespace, and optionally stripping semicolons. Preserves string literals, template literals, and regex patterns. Shows size reduction stats. Runs entirely in your browser — your data never leaves your machine.
javascript minifier minify compress typescript code
Published May 30, 2026
All interactive tools run entirely in your browser. Your data never leaves your device.
How It Works
Paste JavaScript or TypeScript code and get a minified version with comments and unnecessary whitespace removed. The minifier is string-aware — it never modifies content inside string literals, template literals, or regex patterns.
Features
- Comment removal: strips single-line (
//) and multi-line (/* */) comments - Whitespace collapse: removes unnecessary spaces, tabs, and newlines
- Optional semicolons: remove trailing semicolons before
}and) - String-safe: preserves content in
"...",'...', and`...`literals - Regex-safe: detects and preserves regex literals (
/pattern/flags) - Template literal support: handles
${expressions}inside backtick strings - Size stats: original vs minified size, bytes saved, reduction percentage, line count
- Configurable: toggle each optimization independently
- 5 examples: function, arrows, class, objects, async/await
- Private: runs entirely in the browser — no data transmitted
Use Cases
- Quick-minifying JavaScript snippets for inline scripts
- Estimating minification savings before running a full build
- Stripping comments from configuration files
- Preparing code for embedding in HTML
- Learning how minification works step-by-step