Sites and apps similar to TrimCSS include DropCSS, which is free and open source. Other options are PurifyCSS, Purgecss, uCSS and UnCSS. In total there are six sites and apps like TrimCSS for self-hosting.
DropCSS is an unused CSS cleaner; it takes your HTML and CSS as input and returns only the used CSS as output. The core is simply some minimal glue between these awesome low-level tools: