Minifying a small stylesheet by hand, and the spaces you must keep
Take a small stylesheet for a button. It starts with a comment, /* Buttons */. Then comes a .btn rule with three declarations: color: #ffffff, margin: 0px 0px 0px 0px, and a background with url("icons/arrow.svg") no-repeat. Next is a hover rule written as ".btn :hover" with width: calc(100% - 2rem). After that is a licence comment, /*! MIT licence */, and a media query for screens up to 600px wide in portrait, which sets display: block !important. Laid out with line breaks and two-space indents, the file is 274 bytes.
Most of the work is plain removal. The /* Buttons */ comment goes, because the browser never reads it. The line breaks and indents go. The space after the colon in each declaration goes, and so does the space before each opening brace. The last semicolon in each block goes too, because CSS only needs a semicolon between declarations, not after the last one. "!important" loses its leading space. The result is 224 bytes, about 18% smaller, and it is one long line.
A few spaces survive, and each one matters. The first is in ".btn :hover". With the space, the rule matches any element inside a button while it is hovered. Without the space, ".btn:hover" matches the button itself. A minifier that removed it would change your page. The next two are inside calc(100% - 2rem). CSS requires spaces around + and - in calc(), so "100%-2rem" is invalid and the browser drops the whole declaration. The last is in the media query: "and (orientation: portrait)" needs the space between "and" and the bracket. The minifier knows each of these cases and keeps them.
Some things the minifier deliberately leaves alone. The licence comment stays, because a comment starting with /*! is the usual way to mark text that must ship with the code. The url() value and the quoted file name are copied as they are. #ffffff is not shortened to #fff, and the four zero margins are not collapsed to "0". A more aggressive tool would make those changes and save another 17 bytes. The trade is that each rewrite is a place where a bug can change your layout. This tool chooses output you do not have to retest.
There are limits worth knowing. The tool does not remove unused rules, because it cannot see your HTML. It does not merge duplicate selectors or reorder anything. It also does not check that your CSS is valid: a missing brace stays missing. Finally, the saving you see is the saving on disk. If your server already sends CSS with gzip or Brotli, as most do, the difference on the wire is smaller, because compression already shrinks repeated whitespace well.