Code Minifier
Minify HTML, CSS, and JavaScript instantly in your browser. Reduce file size by up to 80% with safe, professional-grade compression.
Why use this code minifier?
Minifying code removes unnecessary characters such as extra spaces, line breaks, and comments without changing the intended output. This can reduce the size of HTML, CSS, and JavaScript files, which means less data needs to be transferred when someone loads your website.
This tool supports HTML, CSS, and JavaScript and applies formatting changes suited to each language. It can be useful when you need to quickly reduce the size of a small code file without setting up a separate build tool.
The minification process runs directly in your browser, so you can paste your code, process it, and copy or download the result from the same page.
How to minify your code
- Select the code type you want to minify: HTML, CSS, or JavaScript.
- Paste your original code into the input editor.
- Choose the available optimization options according to your needs. The default options are suitable for normal minification.
- Click Minify or use the displayed keyboard shortcut if available.
- Review the generated code and the size reduction shown by the tool.
- Click Copy to copy the minified code or download it as a file.
- Test the minified file before using it on a live website, especially when aggressive optimization options are enabled.
An example
Suppose you have this CSS code:
/* Header styles */
.site-header {
background-color: #4f46e5;
padding: 20px 40px;
color: white;
}After minification, it can become:
.site-header{background-color:#4f46e5;padding:20px 40px;color:white}The unnecessary comment, spaces, and line breaks have been removed while the CSS rules remain the same. The resulting file is smaller and can be used as the production version of the stylesheet.