Example: tidying a quote form's styles
A freelancer maintaining a plumber's website has a few rules for the quote form, with comments, odd spacing and a theme credit that must stay. She pastes them in, leaves **Keep /*! licence comments** ticked and minifies.
The ordinary comment is removed, the spacing around the colon and the double space in the padding are cleaned up, the final semicolons go, and the /*! Theme by Example Studio */ credit is kept. The note reports 177 bytes to 137 bytes, 22.6% smaller.
/* Quote form */
.quote-form input ,
.quote-form select {
border : 1px solid #c9d2dc ;
padding: 8px 12px;
}
/*! Theme by Example Studio */
.btn:hover { background: #0b5; }.quote-form input,.quote-form select{border:1px solid #c9d2dc;padding:8px 12px}/*! Theme by Example Studio */ .btn:hover{background:#0b5}
177 bytes to 137 bytes (22.6% smaller)Minifying or beautifying
Paste the CSS
A whole stylesheet or a few rules. The box starts with a sample you can replace.
Choose the mode
Minify for a smaller file to put live; Beautify to read or edit CSS that has already been compressed.
Set the options
Pick a 2 or 4 space indent for beautifying. When minifying, choose whether to keep comments that start with /*!, which is how licences and credits are usually marked.
Copy or download
Copy the result, or download it as styles.min.css.
What minifying changes and what it leaves alone
| Changed | Left as it is |
|---|---|
| Ordinary /* */ comments removed | /*! licence comments, if you keep them |
| Spaces and line breaks around { } ; : , > ~ removed | Spaces inside selectors that mean descendant, such as .nav li |
| Last semicolon in each rule dropped | Strings and url() values |
| Repeated spaces collapsed | Colours, units and property values |
Is it worth it?
For a small business site the saving is usually a few kilobytes, and most hosting already compresses files with gzip or Brotli on the way out. Minifying still helps a little, and it is a good habit for stylesheets you embed directly into a page or an email template. Keep the readable original as your working copy, and beautify a minified file only when you have lost the source.
Questions people ask
Does minifying CSS change how the page looks?
It should not. Minifying removes comments and whitespace that browsers ignore anyway, and keeps the selectors, properties and values the same. Test the minified file on the live page all the same, especially if the original CSS had unusual hacks or unclosed comments.
Why keep /*! comments?
By convention, a comment starting with /*! marks a licence or credit that must stay with the code, for example in a theme or framework. Keeping them is the default here. Untick the option only if you are sure the licence lets you remove the notice.
Can I turn minified CSS back into readable CSS?
Yes. Choose Beautify and paste the minified CSS. Each rule is put on its own lines with one declaration per line and the indent you choose. Comments that were removed during minifying cannot come back, so keep your original source.
Will it minify JavaScript or HTML too?
No, this tool only handles CSS. JavaScript and HTML have their own rules about what whitespace can safely be removed, so use a minifier made for each. Running CSS rules on JavaScript would break it, because spacing and line breaks can change what a script means.
Where your data goes
Your stylesheet is minified or beautified by code in the page. It is not uploaded, and the downloaded file is created in your browser.
Checked against the tool on