About JavaScript Minifier
This JS minifier is for sites without a build step: a script in a WordPress theme, a snippet on a landing page, a small widget you host yourself. Paste the code or open a .js file, and the minified version appears as you type, together with the size before and after. For a script embedded in an HTML page, the HTML Minifier minifies it along with the markup.
It works in a safe mode. Comments and whitespace are removed, except license comments that start with /*!, and a line break is kept wherever JavaScript's automatic semicolon insertion depends on it, so code written without semicolons still runs the same way. Variable names aren't shortened. That keeps function names readable in error messages, but it also means smaller savings than a full build tool gives. For renaming and dead-code removal, use esbuild or terser in your build. The JavaScript Formatter turns minified code back into something readable. Nothing is uploaded.
How to use JavaScript Minifier
- 1Paste your JavaScript
Paste the code or open a .js file.
- 2Check the savings
The JavaScript minifier updates live and shows the size before and after.
- 3Copy or download
Copy the minified code or download it as a file.
Why use Cubfile for this
- Safe mode
Only comments and whitespace go, and the code itself isn't rewritten.
- Aware of semicolon insertion
Line breaks that automatic semicolon insertion relies on are kept.
- License comments kept
Comments written as /*! … */ stay in the file.
- Savings shown
See the size before and after before you copy.