TTKTheTextKit

CSS Minifier and Beautifier

Paste your CSS and choose Minify to strip comments and whitespace and see how many bytes you save, or choose Beautify to turn compressed CSS into readable code with one declaration per line and indented blocks. The tool leaves strings, url() contents and the spaces calc() needs alone, keeps the space in selectors like .card :hover, and can keep /*! licence */ comments. Everything runs in your browser.

Minified

259 bytes to 197 bytes: 62 bytes saved (23.9%)

Minifying removes comments, extra spaces and line breaks, drops the last semicolon in each block and writes 0.5 as .5, so the file is smaller to send. It leaves strings and url(...) contents alone, keeps the spaces that calc() needs around + and -, and keeps the space in a descendant selector such as .card :hover. It does not rename classes, merge rules or change colours and units, so the page looks identical. Beautifying does the reverse for reading: one declaration per line, indented blocks and one selector per line. For real sites a build step with gzip or Brotli saves more, but a quick minify is handy for snippets and email. Everything is worked out in your browser.

Related Tools

[5 suggestions]

About the CSS Minifier and Beautifier

Minifying CSS makes the file smaller so pages load faster. The minifier removes comments, collapses runs of whitespace, drops the space around braces, semicolons, commas and the combinators greater than, plus and tilde, removes the space after a colon in declarations, deletes the final semicolon in each block and shortens numbers such as 0.5 to .5. It is careful about the places where whitespace matters. Spaces inside strings and unquoted url() values are kept exactly. Inside calc() the spaces around plus and minus are kept, because calc(1px+2px) is invalid CSS. A descendant selector such as .card :hover has a space that changes its meaning, so it stays, while .card > .body loses the spaces around the combinator. The tool does not rename classes, merge rules, shorten colours or remove units, so the page renders the same. The beautifier is the reverse: it puts each selector of a list on its own line, each declaration on its own line, indents nested blocks and at-rules, and adds the space after each colon and comma. Running the minifier twice changes nothing, and beautifying then minifying gives the same result as minifying directly. Savings depend on how much whitespace and commenting the original had, and compression with gzip or Brotli on the server shrinks the file further. The beautifier and minifier handle nested rules and custom properties.

What does a CSS minifier do?▾

It removes everything the browser does not need: comments, extra spaces, line breaks and the last semicolon in each block. The styles apply the same way, but the file is smaller and downloads faster.

Does minifying CSS change how my page looks?▾

No. Only characters that have no effect on how browsers read the CSS are removed, and the tool keeps the spaces that matter, such as the one in calc() or in a descendant selector. Always test after minifying, as with any build step.

Can I turn minified CSS back into readable code?▾

Yes. The Beautify mode adds line breaks and indentation. Comments that were removed by minifying cannot be restored, but the structure and values come back in full.

Is minifying enough, or do I need gzip too?▾

They work together. Minifying reduces the characters, and gzip or Brotli compression on your server shrinks the minified file further. Most hosting platforms compress text files automatically.

Is my CSS uploaded?▾

No. The tool runs in your browser and nothing you paste is sent anywhere.