HTML, CSS & JavaScript Minifier
Pick a language, paste code and minify it. JavaScript is processed by the open-source Terser library; HTML and CSS use careful built-in minifiers that favor safety over maximum savings.
Review the output and test your site before deploying minified code.
Your input stays in your browser and is not sent to a server by this page.
What it is and when to use it
Minifying removes whitespace, comments and unneeded characters so files download faster. For JavaScript, Terser can also shorten local variable names. Use this tool for a quick check of how much a snippet can shrink, or when you do not have a build step set up.
How to use
- Choose HTML, CSS or JavaScript.
- Paste your code.
- Select Minify and compare the original and minified sizes.
- Copy or download the result, then test it.
Example
.card {
color: #2563eb;
margin: 0 auto;
}.card{color:#2563eb;margin:0 auto}Tips and common mistakes
- Keep your original, readable source and minify a copy. Minified code is hard to edit and debug.
- Always test the minified result. If JavaScript has a syntax error, minification will fail and report it.
- Be careful with HTML that contains
<pre>or<textarea>, where whitespace is meaningful. - Minification and server compression (gzip or Brotli) work together. Do both for the smallest transfer size.
Frequently asked questions
Is the minified code guaranteed to behave the same?
No tool can guarantee that for every input. JavaScript is handled by Terser, a widely used parser-based minifier, but you should always test the output. The HTML and CSS minifiers are deliberately conservative.
What does the HTML minifier keep untouched?
Content of pre, textarea, script and style elements and attribute values. It removes comments and collapses extra whitespace elsewhere.
Why is the reduction percentage approximate?
It compares character counts before and after. Real transfer size also depends on server compression such as gzip or Brotli.