A CSS minifier works by parsing the original CSS code and then removing unnecessary elements. It compresses the code by eliminating white spaces, line breaks, and comments. Some advanced minifiers also optimize the code by shortening variable names and merging similar rules. The result is a compact and efficient CSS file that serves the same purpose as the original.