CSS Formatter
Beautifies CSS with one declaration per line and consistent indentation.
Shrink CSS by removing comments, whitespace, and redundant characters. See the size before and after, including the gzipped size your visitors actually download.
.css file./*! ... */ notices you must keep.The minifier reads the CSS token by token, so strings, url() values, and comments are recognised before anything is removed.
/*! ... */ comments when you keep license comments.{, }, :, ;, ,, and >, and collapsed to one space elsewhere. Spaces around + and - inside calc() are kept, because CSS needs them.} is dropped, and empty rules are removed.#ffffff become #fff when all three pairs repeat.Input (123 bytes):
/* Buttons */
.btn {
color: #ffffff;
padding: 8px 16px;
width: calc(100% - 2rem);
}
.btn:hover {
color: #1f5fbf;
}Output (82 bytes, 33% smaller):
.btn{color:#fff;padding:8px 16px;width:calc(100% - 2rem)}.btn:hover{color:#1f5fbf}
Yes. Only characters that browsers ignore are removed, so the styles apply exactly as before. Keep the original file for editing.
It depends on how many comments and how much indentation the file has. The example on this page goes from 123 to 82 bytes, 33% smaller. After gzip the difference is smaller, because gzip already compresses repeated whitespace well.
By convention, a comment that starts with /*! holds a license or copyright notice that must stay in distributed files.
Often used together with CSS Minifier.
Beautifies CSS with one declaration per line and consistent indentation.
Minifies JavaScript with Terser and reports the size saving.
Beautifies HTML with consistent indentation, including inline CSS and JavaScript.