JS Minifier
JS Minifier compresses JavaScript code by removing comments, collapsing whitespace, and stripping unnecessary characters to produce the smallest valid output. We built six JavaScript optimization utilities into one workspace so you can minify, beautify, detect dead code, analyze file size, apply light obfuscation, and strip console statements 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.
JS Minifier
Removes comments, collapses whitespace, and strips trailing semicolons from JavaScript. Configurable options let you control exactly what gets removed.
JS Beautify
Reverses minification by expanding compressed JavaScript into clean, readable code with consistent 2-space indentation using the js-beautify library.
JS Dead Code Finder
Scans for functions, variables, and classes that are declared but never referenced. Reports each unused declaration with line number and type.
JS Size Report
Analyzes original vs minified file size, bytes saved, percentage reduction, line breakdown, and code structure counts with a visual size comparison bar.
JS Obfuscate Light
Converts string literals to hexadecimal escape sequences for basic obfuscation while preserving code structure and behavior.
JS Strip Console
Removes all console.log, console.debug, console.error, and other console method calls from your code before production deployment.
Free JS Minifier with Configurable Compression Options
JavaScript files served to browsers include comments, indentation, and whitespace that the runtime does not need. Every extra byte costs bandwidth, increases parse time, and slows page load speed. Our free JS Minifier removes those unnecessary characters to produce compact output that runs identically to the original. Three configurable checkboxes let you control exactly which optimizations to apply: Strip Comments removes single-line and block comments, Collapse Whitespace joins lines and reduces spaces, and Strip Trailing Semicolons removes semicolons before closing braces for additional byte savings.
Real-Time Size Comparison
As you paste or upload JavaScript, the stats bar at the bottom instantly shows your original file size, the minified output size, bytes saved, and percentage reduction. You can see exactly how much each optimization contributes by toggling individual checkboxes and watching the numbers update in real time. This makes it easy to find the right balance between compression and readability for your specific use case.
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.
Online JS Minifier with Dead Code Finder and Size Report
Beyond basic minification, our online JS Minifier workspace includes complementary tools for a complete optimization workflow. JS Beautify reverses minification so you can inspect compressed production code. JS Dead Code Finder scans for functions, variables, and classes that are declared but never referenced, helping you identify code that can be safely removed before minifying. JS Size Report produces a comprehensive breakdown comparing original and minified sizes with visual bar charts, line counts, and code structure metrics. JS Obfuscate Light converts string literals to hex escape sequences for basic obfuscation. JS Strip Console removes all console.log, console.debug, console.error, and other debug statements before you ship to production.
Find and Remove Dead Code Before Minifying
The Dead Code Finder uses heuristic analysis to count how many times each declared function, constant, and class is referenced in your code. Declarations that appear only once (at their definition) are flagged as potentially unused. Each finding includes the line number and declaration type so you can quickly locate and review the code before deciding whether to remove it. Running this analysis before minification can reduce file size by a significant margin beyond what whitespace removal alone achieves.
Strip Console Statements for Production
Debug logging is essential during development but has no place in production. Console statements expose internal state, clutter browser dev tools, and add unnecessary bytes. The Strip Console tool removes all 20+ console method variants in one click, including log, debug, info, warn, error, trace, table, time, timeEnd, group, groupEnd, assert, dir, count, clear, and profile. The stats bar shows exactly how many bytes you saved by removing debug output.
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 Formatter -- format, minify, validate, escape, convert JS to JSON, and analyze code structure
- JavaScript Formatter -- format, minify, validate, unescape, deobfuscate, and count lines in JavaScript
- JS Pretty Print -- pretty print JavaScript with configurable indent and bracket matching
- JavaScript Validator -- validate JavaScript syntax and check for errors
- Code Formatter -- format JavaScript, HTML, CSS, JSON, and more in one workspace
- JSON Formatter -- format, minify, validate, and transform JSON data
- CSS Pretty Print -- pretty print, compact, autoprefix, and lint CSS code