JavaScript Minifier Online
Minify JavaScript code instantly in your browser — remove whitespace and comments
Input JavaScript
How to minify JavaScript online
Paste your JavaScript, hit Minify, copy the output. Whitespace, comments, and unnecessary characters are stripped — the engine still runs the exact same code, just from a smaller file.
What gets removed during JS minification
Whitespace, tabs, and newlines — the JavaScript engine ignores all of them. Single-line and multi-line comments. Trailing commas before closing brackets. Unnecessary semicolons in places where ASI (automatic semicolon insertion) would handle it.
This tool does not rename variables or mangle function names (that's obfuscation/uglification, which is a separate step). What you get is a clean, whitespace-stripped version of your exact code — smaller but not restructured.
Typical reduction is 20—40% on unminified source. Combined with gzip compression on the server, you'll see the actual transfer size shrink even further.
Minification vs bundling vs tree-shaking
These are three different things that often happen together in build tools. Bundling combines multiple JS files into one. Tree-shaking removes unused exports and dead code paths. Minification shrinks the remaining code by removing whitespace and comments. If you're using Vite, Webpack, or esbuild, all three happen automatically in production builds. Use this tool when you need to quickly compress a standalone script without a full build pipeline.
Complete Developer Toolkit
JavaScript minification is one part of a complete front-end performance workflow. Pair it with our CSS minifier to compress your stylesheets at the same time — both JS and CSS minification together dramatically reduce total page weight. Our JSON formatter helps you clean up and validate data files before they get bundled, and our HTML to Markdown converter is useful when you need to restructure content files in your project. For encoding assets and API tokens embedded in your JS, our Base64 encoder handles binary-to-text conversion cleanly.
Before minifying, use our regex tester to validate any regular expressions in your code, and our diff checker to compare your original source against the minified output. Our URL encoder encodes any string parameters your JavaScript constructs for API calls. For debugging the API responses your JavaScript consumes, our API response simulator mocks server data locally. The JavaScript array methods reference is a quick lookup when writing or reviewing the code before minification. If your project also processes JWT tokens, our JWT decoder lets you inspect the payload structure.
How to Use This Tool
- 1 Paste your JavaScript into the Input field.
- 2 Click Minify JS.
- 3 The compressed output appears with the size reduction shown.
- 4 Click Copy to Clipboard.