Code Minifier
Minify CSS, HTML and JavaScript right in your browser. Remove comments and whitespace, and see the before/after size and reduction rate.
How to Use
Pick a tab and paste code
Switch between the CSS / HTML / JavaScript tabs and paste the code you want to minify into the input field.
Click "Minify"
Comments and whitespace are removed, and the before/after size and reduction rate are displayed.
Copy the result
Use the "Copy" button to grab the minified code and paste it into your production file.
What is Code Minification?
Minification removes unnecessary comments, whitespace and line breaks from code to shrink the file size without changing how it behaves. Smaller files load faster, improving page rendering and Core Web Vitals. This tool uses a safe in-house minifier for CSS and HTML that protects string and comment regions, and the popular terser library for JavaScript. All processing happens entirely in your browser, so your code is never sent to any server.
Features
- CSS / HTML / JS SupportSwitch tabs to minify three kinds of code, each with its own optimized routine.
- Safe Minify LogicCSS/HTML protect strings and comment regions before compressing; JS is reliably minified with terser.
- Reduction at a GlanceSee the before/after file size and reduction rate so the effect is obvious instantly.
- Fully Browser-BasedEverything runs in your browser. Your code is never sent to a server—privacy protected.
Use Cases
- Shrink CSS/JS before going live to speed up rendering
- Address the "Minify" warnings in PageSpeed Insights
- Reduce file size of HTML emails and landing pages
- Manual minify for small sites without a build pipeline
- Check the size of snippets and inline code
FAQ
Is the code minifier free to use?
Is my code sent to a server?
Does minifying change how my code behaves?
How is JavaScript minified?
Could strings inside CSS/HTML comments get broken?
Can I use it on my smartphone?
Feedback
Missing a feature, or getting a result that looks wrong? Let us know — we improve our tools based on your feedback.