Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

CSS Minifier

CSS

Paste CSS, or

CtrlV paste · Ctrl↵ run now

Minified CSS
Ready
Ln 1, Col 1
Runs in your browser. Nothing you paste is uploaded unless you share it.

Minify CSS with csso: shorter colors, duplicate rules merged, license comments kept (or all, or none), size saved in bytes

Shrink a stylesheet for production: spaces and comments go, values get their shortest form, and rules that say the same thing are merged.

How to use it

  1. Paste CSS, or open a .css file.
  2. Pick which comments stay: license comments (/*!), all, or none.
  3. Read the size in bytes in the status bar, before and after, with the percent saved; copy it or download minified.css.

Examples

Shorter colors and zeros

Input
.alert {
  color: #ff0000;
  margin: 0px 0px 4px 0px;
}
Result
.alert{color:red;margin:0 0 4px}

Rules with the same declarations merged

Input
.error {
  color: red;
}
.warning {
  color: red;
}
Result
.error,.warning{color:red}

License comments kept

Input
/*! Theme v2 | MIT */
/* layout */
.page {
  max-width: 960px;
}
Result
/*! Theme v2 | MIT */
.page{max-width:960px}

A comment starting /*! is kept, as licenses ask; others go.

Every comment kept (Comments: All)

Input
/* layout */
.page {
  max-width: 960px;
}
/* type */
h1 {
  font-size: 2rem;
}
Result
/* layout */
.page{max-width:960px}
/* type */
h1{font-size:2rem}

Each comment between rules stays on its own line.

How it minifies

csso, an open-source CSS optimizer, reads the stylesheet and writes it back in its shortest form with the same meaning: #ff0000 becomes red, 0px becomes 0, margin 0 0 4px 0 loses its last value, and the same declarations in neighboring rules are joined.

CSS it can’t read stops with the line and column rather than being dropped, so nothing disappears from your stylesheet unnoticed. SCSS or Less is named as such: compile it first (sass, lessc).

Comments: License keeps those starting /*!, as licenses ask; All keeps every comment between rules (csso drops comments inside a rule); None removes them all.

Sizes are UTF-8 bytes, as the file is saved and sent: “é” counts 2 and an emoji 4.

Questions

Is merging rules safe?
csso merges rules only where moving them doesn’t change which declaration wins, so each element keeps the same styles.
How much smaller will it get?
It depends on how the stylesheet was written: one full of comments and spaces shrinks a lot, one already minified hardly at all. The status bar shows the bytes and the exact percent for yours.
Is my CSS uploaded?
No. Everything runs in your browser, so your stylesheet stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first.

Related tools