JavaScript Minifier
Create compact JavaScript source without running it. Terser parses the input inside a dedicated browser worker and returns text. This integration removes unnecessary formatting but deliberately disables compression transforms and identifier mangling. Public names and ordinary control flow therefore remain easier to compare with the original. The library loads only when this tool is used, and the worker is terminated after a bounded timeout. There is no server compilation step, package upload or execution of pasted functions.
Your workspace
Runs locally in your browserResult
Your input is processed locally in your browser unless explicitly stated otherwise. Inputs are not saved by this tool.
How to use this tool
Paste JavaScript, select Minify and wait for the worker result. Correct syntax errors, then copy the compact code.
Example
Input
function add(a, b) { return a + b; }Output
function add(a,b){return a+b}What does this tool do?
Minification is different from bundling and transpilation. It does not resolve imports, combine files, install packages or convert modern syntax for old browsers. TypeScript types and JSX need their own compilation step before ordinary JavaScript minification. Keep source files in your repository; this output has no generated source map.
Common mistakes and limitations
Whitespace can change JavaScript token boundaries, so blindly deleting it can alter code. Terser handles syntax rather than treating source as plain words. Even with conservative settings, compare behavior in your own test suite before deploying generated assets. Important /*! comments are retained; review other legal notices yourself. Minified code is not encryption or meaningful protection for secrets embedded in a client application.
Frequently asked questions
Are functions executed to optimize them?
No. This tool parses source only, with compression and mangling disabled. It never evaluates user code.
Related tools
CSS Minifier
Minify CSS with a local parser while preserving strings and important comments.
Open tool Developer ToolsHTML Formatter
Format HTML source as inert text with two- or four-space indentation.
Open tool Developer ToolsJSON Minifier
Remove unnecessary whitespace from valid JSON.
Open tool Developer ToolsRegex Tester
Test JavaScript regular expressions and inspect matches.
Open tool