JavaScript Minifier
JavaScript Minifier compresses your JavaScript code by stripping comments, removing console statements, and collapsing whitespace into the smallest valid output. We built six JavaScript optimization utilities into one workspace so you can minify, expand minified code, strip custom patterns with regex, extract license comments, find unused imports, and estimate bundle weight without switching between different tools. Paste your JavaScript into the code editor on the left, upload a .js file from your computer, or drag and drop it onto the workspace. All processing happens locally in your browser, so your source code never leaves your device and no account is required.
JavaScript Minifier
Configurable compression pipeline with toggleable stages: strip comments, remove console calls, and collapse whitespace. Visual pipeline bar shows active stages and reduction percentage.
JS Expand
Reverses minification by expanding compressed JavaScript into clean, readable code with 2-space indentation using the js-beautify library.
JS Regex Strip
Removes all text matching a custom regular expression. Strip TODO comments, feature flags, deprecated markers, or any pattern from your code.
License Extractor
Scans for comments containing license, copyright, MIT, Apache, GPL, BSD, ISC, and SPDX keywords. Lists all matching comments for compliance auditing.
Unused Imports
Analyzes ES module import statements and identifies identifiers that are imported but never referenced elsewhere in the code.
Bundle Weight
Estimates original, minified, and gzipped sizes for your code plus external dependencies from a built-in package size database.
Free JavaScript Minifier with Visual Compression Pipeline
JavaScript files delivered to browsers carry comments, indentation, blank lines, console statements, and other content that the runtime ignores. Every extra byte costs bandwidth, increases parse time, and slows page rendering. Our free JavaScript Minifier removes those unnecessary characters through a configurable pipeline that you can control visually. Three independent stages appear as toggleable steps in a pipeline bar above the editor: Strip Comments, Strip Console, and Collapse Lines. Click any stage to enable or disable it and watch the reduction percentage update instantly. This gives you precise control over which optimizations to apply for each use case.
Toggle Each Compression Stage Independently
Unlike one-click minifiers that apply a fixed set of transforms, our pipeline lets you customize compression for each situation. Need to keep console statements for staging environments? Turn off Strip Console. Want to preserve inline documentation? Disable Strip Comments and only collapse whitespace. Each combination produces a different output, and the stats bar at the bottom shows input size, output size, bytes saved, and line count changes so you can evaluate the trade-off immediately.
Upload JavaScript Files Directly
You can load JavaScript into the workspace three ways: paste it into the code editor on the left, drag and drop a file anywhere onto the workspace, or click the Upload JS button. We accept .js, .mjs, .cjs, .jsx, .ts, and .tsx files. Because everything runs in your browser, there is no file size limit imposed by a server, and your files never leave your machine. This makes the minifier safe for production scripts containing API keys, internal logic, and proprietary algorithms.
Online JavaScript Minifier with Unused Import Finder and Bundle Weight
Beyond minification, our online JavaScript Minifier workspace includes advanced tools for comprehensive code optimization. JS Expand reverses minification so you can inspect compressed production code. JS Regex Strip lets you remove any text matching a custom regular expression, which is useful for stripping TODO comments, FIXME annotations, deprecated function calls, or feature flag code before deployment. License Extractor scans for comments containing copyright and license keywords, listing all matches for open-source compliance auditing. Unused Imports analyzes your ES module import statements and identifies identifiers that are imported but never referenced in the code body. Bundle Weight estimates the total size of your code plus external dependencies by looking up known package sizes from a built-in database.
Estimate Your Total Bundle Size
The Bundle Weight tool goes beyond measuring your code alone. It scans import and require statements to identify external packages, then looks up their minified and gzipped sizes from a database covering React, Vue, Axios, Lodash, Day.js, Date-fns, Chart.js, D3, Moment, Three.js, and other common libraries. The final report estimates your total bundle weight combining your code and all detected dependencies, helping you understand the real cost of your imports before they reach production.
Your JavaScript Stays Private in Your Browser
We process everything locally using JavaScript APIs in your browser. No server requests, no cookies, no account required. The js-beautify library is loaded once from a public CDN and all subsequent processing runs completely offline. You can safely minify production scripts, proprietary modules, and internal utilities knowing that nothing is transmitted anywhere.
Related Online JavaScript and Code Tools
If you work with JavaScript regularly, these free tools complement what you can do here:
- JS Minifier -- minify, beautify, find dead code, analyze size, obfuscate, and strip console
- JS Formatter -- format, minify, validate, escape, convert JS to JSON, and analyze code
- JavaScript Formatter -- format, minify, validate, unescape, deobfuscate, and count lines
- JavaScript Compress -- compress, strip comments, console, debugger, and analyze size
- JS Pretty Print -- pretty print JavaScript with configurable indent and bracket matching
- JSON Formatter -- format, minify, validate, and transform JSON data
- Code Formatter -- format code across multiple programming languages