CSS Minifier/Beautifier

Minify or beautify CSS.

This tool turns CSS into a compact single line for production or into a neatly indented, readable layout for review. It is useful for front-end developers who need to shrink a stylesheet before pasting it into a page, or who received a minified file and want to read it. You can load a .css file, pick the indent width, and decide whether comments survive minification.

What is CSS minification?

Minification removes everything the browser does not need to interpret a stylesheet: line breaks, indentation, spaces around braces, colons, commas and combinators, the last semicolon in a rule, and usually comments. The rules and their meaning stay the same, but the file gets smaller, so it downloads and parses faster. Beautifying is the opposite operation: it puts each selector and declaration on its own line, indents nested blocks such as media queries, and normalises spacing after colons and commas. Strings and comments are protected during both operations so their content is never altered by the whitespace rules. This tool applies simple whitespace-based rules and does not merge selectors, shorten colors or reorder properties.

How to use CSS Minifier/Beautifier

  1. Provide the CSS Paste your stylesheet into the CSS box or use the file button to load a .css file.
  2. Set the options Pick 2 spaces or 4 spaces under Indent and tick Keep comments (minify) if comments should survive minification.
  3. Run an action Click Beautify for indented output or Minify for the compact single-line version.
  4. Copy or download Copy the result or download it as styles.css.

Frequently asked questions

Does minifying change how my CSS behaves?

It should not. Only whitespace, the last semicolon of each rule and (by default) comments are removed. Quoted strings are protected. Still, test the result in your page, especially for unusual syntax, because the tool uses simple text rules rather than a full CSS parser.

Does it shorten colors or merge rules?

No. The tool does not rewrite values, convert #ffffff to #fff, merge duplicate selectors or reorder declarations. For that level of optimisation use a dedicated build-time optimiser.

How do I keep comments?

Tick Keep comments (minify) before pressing Minify. The comments are then kept in the compact output. When the box is off, all block comments are removed.

What does the Indent option change?

Indent sets whether Beautify uses 2 spaces or 4 spaces per nesting level. It has no effect on Minify.

Can I load a file?

Yes. Use the file button next to the input to load a .css file, then run Beautify or Minify. The output can be copied or downloaded as styles.css.