Code Minifier
Minify JavaScript (Terser), CSS (CSSO), HTML, JSON or XML in one tool: pick the language, paste code and see the bytes saved. Free and runs in your browser.
Runs entirely in your browser. Your data is never uploaded.
Related Tools
View AllWhat is Code Minifier?
The Code Minifier is one place to minify several languages. Choose JavaScript, CSS, HTML, JSON or XML and it applies the appropriate minifier, showing the original and minified size.
How to use Code Minifier
- Select the Language.
- Paste your code into the input box.
- Click Minify (the output also updates while you type).
- Copy or download the minified code.
Example
a { color : red ; } a{color:red} Language: CSS.
When to use Code Minifier
Use it for quick, one-off minification and size comparisons. For production applications, minify in your build pipeline with source maps. The dedicated minifier pages explain each engine in more detail.
How Code Minifier works
Each language uses a dedicated engine: JavaScript – Terser with compression and local name mangling; CSS – CSSO structural minification after a brace/string check; HTML – a safe minifier that removes comments and collapses whitespace but keeps pre, textarea, script and style untouched; JSON – strict parsing and compact printing that preserves numbers; XML – well-formedness check, then whitespace between tags and comments are removed.
Common Use Cases
- Minifying a snippet before inlining it into a page
- Comparing the size of different code versions
- Compacting JSON or XML payloads
- Removing comments before sharing code
Security Note
Everything runs locally in your browser; the code you paste is not uploaded.
FAQs
Which language is selected by default?
JavaScript. Change it with the Language selector.
Does it generate source maps?
No.
Can it minify TypeScript?
No, compile TypeScript to JavaScript first.