Free Online Minify JS
Minify JS is a browser-based code compression tool that reduces the file size of your JavaScript by stripping comments, collapsing whitespace, removing console statements, and optionally shortening variable names. We built six minification utilities into one workspace so you can also minify CSS, HTML, JSON, SVG, and XML without switching between different tools. Paste your code into the editor, upload a file from your computer, or drag and drop it onto the workspace. A circular gauge instantly shows how much space you saved and all processing happens locally in your browser so your code never leaves your device.
Minify JS
Strips comments and whitespace from JavaScript with options to drop console calls and shorten variable names for deeper compression.
Minify CSS
Removes comments, collapses whitespace, and strips trailing semicolons to produce a single-line production stylesheet.
Minify HTML
Removes HTML comments and collapses whitespace between tags for a smaller document that renders identically.
Minify JSON
Parses and re-serializes JSON without indentation or whitespace. Validates input and reports errors for malformed JSON.
Minify SVG
Removes comments, strips the XML declaration, and collapses whitespace for smaller SVG files that render the same way.
Minify XML
Strips comments and inter-element whitespace from XML while preserving CDATA sections, namespaces, and processing instructions.
Online Minify JS with Compression Gauge and File Upload
Unminified JavaScript files ship with comments that developers wrote for their own reference, indentation that makes the code readable in an editor, and debug statements like console.log that serve no purpose in production. Every extra byte adds to download time, especially on mobile networks where latency is high and bandwidth is limited. Our online Minify JS tool solves this by running multiple compression passes on your code and showing the results in real time with a circular gauge that displays exactly how much smaller your file became.
Upload Files From Your Computer
You can load code 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 File button. For JavaScript, we accept .js, .mjs, .cjs, .jsx, .ts, and .tsx files. Each sub-tool accepts the file types relevant to its language. Because everything runs in your browser, there is no file size limit imposed by a server and your code never leaves your machine.
Configurable JavaScript Minification
The JavaScript minifier gives you four toggle switches that control the compression behavior. Remove Comments strips both single-line (//) and block (/* */) comments. Collapse Whitespace joins lines and removes redundant spaces around operators and braces. Drop Console removes every console method call including log, debug, info, warn, error, trace, dir, table, time, timeEnd, group, groupEnd, count, assert, clear, profile, and profileEnd. Shorten Variables renames local identifiers to single-character names for additional size reduction.
Minify CSS, HTML, JSON, SVG, and XML in One Workspace
Most projects use more than just JavaScript. Stylesheets, markup, data files, and vector graphics all benefit from minification. Instead of finding a separate tool for each format, you can switch between six minifiers using the sidebar. The CSS minifier collapses whitespace around selectors and properties and strips trailing semicolons. The HTML minifier removes comments and collapses inter-tag whitespace. The JSON minifier parses and re-serializes without indentation, and it validates your input so you know immediately if the JSON is malformed. The SVG minifier strips comments, removes the XML declaration, and cleans up attribute spacing. The XML minifier removes comments and inter-element whitespace while preserving CDATA sections and namespace declarations.
Real-Time Compression Metrics
Every time you change the input or toggle an option, the output updates automatically. A compression gauge above the minified output shows the percentage saved as a filled ring. Beside it, you see the original size, minified size, saved bytes, line count reduction, and the number of comments stripped. These metrics help you understand exactly what the minifier did and how much bandwidth each optimization saves.
Your Code Stays Private in Your Browser
We process everything locally using JavaScript in your browser. No server requests, no cookies, no account required. You can safely minify production bundles, proprietary libraries, API responses with sensitive data, and internal configuration files knowing that nothing is transmitted anywhere. The workspace works offline once loaded.
Related Free Developer and Minification Tools
If you work with code minification regularly, these tools complement what you can do here:
- JavaScript Optimizer -- optimize, analyze, and clean JavaScript with dead code detection
- JS Minifier -- dedicated JavaScript minifier with whitespace and comment removal
- CSS Formatter -- format, minify, and beautify CSS stylesheets
- HTML Formatter -- format and beautify HTML with proper indentation
- JSON Formatter -- format, minify, validate, and transform JSON data
- XML Formatter -- format, minify, validate, and convert XML
- SQL Formatter -- format and beautify SQL queries
- Regex Tester -- test regular expressions against sample text