Web & Developer Utilities100% Client-Side

CSS Minifier for Stylesheet Snippets

The CSS Minifier takes a small stylesheet snippet and reduces the space occupied by comments, line breaks, and some separators. Paste ordinary rules to get a compact string you can copy into a fixture or demo. It keeps the declarations in their original order, which matters when several rules can apply to the same element. Check quoted values and special syntax before relying on the compact output in a published stylesheet.

Input
92 chars•6 lines
Output

Reverse tool

CSS Prettifier

Expand compact CSS into readable selectors and declaration blocks. Choose two- or four-space indentation for stylesheets, snippets, and review examples.

Open CSS Prettifier

How to Use the CSS Minifier Online

  1. 1Paste the CSS you want to make compact. Keep a readable source copy nearby so you can compare every declaration afterwards.
  2. 2Inspect the result where selectors and declarations meet. The tool removes whitespace around common punctuation and the last semicolon before a closing brace.
  3. 3Check comment markers, strings, and custom property values against the source if another system reads those parts directly.
  4. 4Copy the compact CSS and try it in the context where it will be used. Compare the computed styles if you are replacing a working snippet.

Input & Output Examples

The comment, line breaks, and final declaration semicolon disappear.

Input Sample
/* Small card */
.card {
  padding: 1rem;
  color: #123;
}
Expected Output
.card{padding:1rem;color:#123}

The group selector becomes more compact while the spaces separating the margin values remain.

Input Sample
h2,
.subtitle {
  margin: 0 0 1rem;
}
Expected Output
h2,.subtitle{margin:0 0 1rem}

Practical Developer Workflows

  • Create a single-line stylesheet fixture for a test that compares raw output from an example component.
  • Trim presentation whitespace from a small static style rule you need to embed in a plain-text example.
  • Compare the compact and readable versions of a selector group before sharing the shorter version in a demo.

Zero Server Uploads & Complete Privacy

Runs 100% in your browser; no data is uploaded to any server.

Notice a bug, calculation error, or outdated info?

Let us know directly so our engineering team can fix it.

Frequently Asked Questions

The minifier keeps selectors and declarations in the order they appear. It applies text transformations for comments and whitespace without analyzing the cascade. A build optimizer can perform more aggressive transformations when they are appropriate for the full stylesheet.

Explore Other Tools

12 suggested tools

View all tools