Paste or upload JavaScript • Minify, compress & beautify • See live size savings • Download instantly — free, private, 100% in your browser.
Remove whitespace • Strip comments • Compress variable names • Beautify • Download minified JS • Zero server upload
Safe removes comments and whitespace. Moderate also removes optional semicolons. Aggressive shortens common patterns further.
Open and minify multiple JavaScript files in separate tabs without leaving the page. Upload .js files directly.
See original size, minified size, bytes saved and compression percentage calculated in real time.
Your code never leaves your browser. No server upload, no logging, no data collection of any kind.
JS Minifier — Free Online JavaScript Minifier and Beautifier with Live Size Statistics
Every millisecond of page load time costs money. Studies from Google, Amazon and Akamai have repeatedly shown that even a one-second delay in page response time leads to measurable drops in conversion rates, higher bounce rates and lower search engine rankings. JavaScript file size is one of the most direct contributors to slow page loads, and minifying your JavaScript is one of the simplest and highest-return optimisations any web developer or site owner can make. Our free JS Minifier tool removes everything from your JavaScript that a browser does not need to execute it — whitespace, comments, blank lines, redundant semicolons — and compresses the result into the smallest possible file that produces identical runtime behaviour. Everything runs entirely in your browser, so your source code is never sent to any server.
What JavaScript Minification Does and Why It Matters
When a developer writes JavaScript, they write it for human readability. Variable names are descriptive, functions are separated by blank lines, complex expressions are spread across multiple lines with indentation, and comments explain the purpose of each section. All of this is essential for maintaining and collaborating on code, but a browser executing the JavaScript does not need any of it. The JavaScript engine reads tokens — function keywords, variable declarations, operators, string literals — and does not care whether they are on separate lines or squashed together. Minification is the process of removing everything that exists only for human readability while preserving every token that affects execution. The result is a file that is functionally identical to the original but may be sixty, seventy or even eighty percent smaller. When served to millions of page visitors over time, that size reduction translates directly into bandwidth savings, faster download times and improved Core Web Vitals scores.
Three Minification Levels to Match Your Needs
Different projects have different risk tolerances when it comes to code transformation. Our JS Minifier provides three distinct minification levels so you can choose the right balance between compression and safety for your specific situation. Safe mode removes all comments — both single-line and block comments — and collapses whitespace by trimming each line and removing unnecessary indentation, while preserving line breaks so the output remains somewhat readable and debuggable. This is the recommended level for production code that has not been tested under transformation. Moderate mode goes further by also removing optional semicolons at the ends of blocks and collapsing the entire file into fewer lines. Aggressive mode applies all of the above transformations and additionally rewrites common JavaScript patterns into shorter equivalents — replacing return true with return!0, return false with return!1, and tightening whitespace around operators — achieving the maximum compression ratio for code that has been well-tested.
Granular Option Controls for Precise Output
Beyond the three preset levels, the JS Minifier provides four individual toggle options that let you customise exactly what gets removed. Remove Comments strips all single-line comments beginning with double forward slashes and all block comments enclosed in slash-asterisk delimiters, which is typically the single largest source of savings in well-documented codebases. Remove Whitespace collapses redundant spaces, tabs and newlines throughout the file. Remove Optional Semicolons takes advantage of JavaScript automatic semicolon insertion to remove semicolons that precede closing braces, slightly reducing file size. Remove console.log() deletes all console.log, console.warn, console.info, console.error and console.debug statements from the output — a critical step before deploying to production, since console statements clutter the browser console for end users and can accidentally expose internal debugging information. Two output formatting options let you add a source map reference comment and a filename header to the minified output for documentation purposes.
JavaScript Beautifier Built In
Minification and beautification are opposite operations, and our tool does both. The Beautify function takes compressed, minified or poorly formatted JavaScript and reformats it with consistent four-space indentation, proper line breaks and aligned structure. This is invaluable when you receive a minified third-party script and need to understand what it does, when you are debugging code that was accidentally committed without formatting, or when you want to inspect the output of a build tool. The beautifier uses an indentation-tracking algorithm that correctly handles nested braces, brackets and parentheses to produce cleanly formatted output that is easy to read and edit.
Multi-File Tab Support
Modern web projects rarely involve a single JavaScript file. Websites typically have separate scripts for analytics, UI interactions, form validation, API communication and third-party integrations. The JS Minifier supports multiple files through a tabbed interface. Each tab holds an independent input and output pair with its own statistics. You can open as many tabs as you need, upload different .js files into each one, minify them independently with different settings, and download each result individually. Uploading multiple .js files at once automatically creates a tab for each file, so you can process an entire project directory quickly without switching between windows or making multiple visits to the tool.
Live Size Statistics and Compression Metrics
The statistics panel above the editor shows five real-time metrics after every minification. Original Size shows the byte count of the input as entered. Minified Size shows the byte count of the compressed output. Saved shows the absolute reduction in bytes, formatted in B or KB as appropriate. Compression shows the percentage reduction in file size — the metric that most directly communicates the efficiency of the minification for a given file. Lines Removed shows how many lines were eliminated in the transformation, giving an intuitive sense of how much redundant content existed in the source. These metrics update instantly on every minification run and help you make informed decisions about which level of compression is appropriate for your files.
Upload, Download, Copy and Keyboard Shortcuts
The JS Minifier is built for speed of use. Paste JavaScript directly into the input area or use the Upload .js button to load one or more files from your computer. After minification, copy the output to your clipboard with a single click or use the Download .js button to save the result as a .min.js file named after your original file. Keyboard shortcuts are available for power users: Ctrl+Enter triggers minification immediately, and Ctrl+Shift+C copies the output without reaching for the mouse. The Paste button reads directly from the clipboard for environments where pasting into the code editor is inconvenient. All of these options are designed to minimise friction and fit naturally into a development workflow where the tool is used repeatedly throughout a session.
Your JavaScript source code contains your intellectual property, your business logic and potentially sensitive configuration. It should never need to leave your machine for a simple compression operation. The JS Minifier runs the entire minification process inside your browser tab with zero network requests, zero server processing and zero data collection. Use it confidently for proprietary code, client projects, internal tools and any other JavaScript you would not want transmitted to an unknown third party.