How to use the HTML / CSS / JS Minifier
- Choose the language
- Paste your code
- Click Minify and copy the result
Minify or beautify code
Choose CSS, JavaScript, HTML or JSON, paste your code and click ๐ฆ Minify โ or โจ Beautify to make minified code readable again. You see the size before and after and the percentage saved. JavaScript uses Terser, the minifier behind most build tools, which also shortens local variable names safely.
What minifying does
Minifying removes comments, spaces and line breaks โ and for JavaScript, renames local variables โ so files download faster without changing what they do. A typical stylesheet shrinks by 20โ40%, and your server's gzip compression comes on top of that.
- CSS โ strips comments and whitespace and shortens values such as
0pxto0. - JavaScript โ compresses and shortens names with Terser.
- HTML โ removes comments and the whitespace between tags.
Back to readable code
Click Beautify to re-indent minified code so you can read it. Original variable names and comments can't be recovered once they have been removed, so always keep your readable source files.
Minifying automatically
- VS Code โ install a minify extension, or use a build tool such as Vite or esbuild that minifies for you.
- WordPress โ caching plugins such as Autoptimize or LiteSpeed Cache have a minify option.