Skip to content
OddsockLocal
Local
Source text

The preview shows up here.

ReadyRuns in this browser. Nothing is uploaded.

How to use

  1. Paste CSS.
  2. Read the minified sheet. Ordinary comments are gone.
  3. Check quoted strings, urls and custom properties for characters you needed to keep.
  4. A comment that should survive has to start with !.

What is CSS minifier?

The minifier removes comments and whitespace that CSS does not need, and it refuses to touch the parts where whitespace is data. p { color: red; /* note */ margin: 0; } .q { content: "a b"; } becomes p{color:red;margin:0}.q{content:"a b"}. The note is gone. The two spaces inside the string are still there.

Read more

A comment whose text starts with ! is kept. That is the usual license-comment convention. Custom properties are treated carefully: a declaration whose name starts with -- does not get its colon spacing rewritten, because a custom property’s value can be significant in ways a color is not. calc() expressions and urls are not reflowed.

The formatter is the other direction. It indents and does not try to save bytes. Minified output is one line when the input’s structure allows it. Invalid CSS fails in the parser rather than being clipped.

Use cases

  • A small stylesheet should lose a review comment and the indentation before it is inlined.
  • A content property holds two spaces on purpose, and a minifier that collapses all whitespace would change the page.
  • A license comment begins with /*! and has to survive the pass.
  • You want to see the size drop from formatting only, without a build tool.

A comment dropped, a string kept

p { color: red; /* note */ margin: 0; } .q { content: "a b"; }

p{color:red;margin:0}.q{content:"a b"}

Why use Oddsock

The spaces inside "a b" are the test. A minifier that cannot keep them will change what the page displays.

Related tools

Using this tool

Quoted values are not whitespace to be collapsed. content: "a b" is still content:"a b" after minify.