CSS Minify API - Remove Comments and Whitespace
Strips /* */ comments, collapses all whitespace runs to single spaces, removes spaces around punctuation ({ } : ; , > ~ +), and drops the last semicolon before closing braces. Returns the minified CSS plus byte counts and savings percent.
Code examples
curl -X POST https://api.botoi.com/v1/minify/css \
-H "Content-Type: application/json" \
-d '{"code":"body {\n margin: 0;\n padding: 20px;\n}\n\n/* reset */\n* {\n box-sizing: border-box;\n}"}'When to use this API
Build-step CSS compression
In a static-site build pipeline, pipe each CSS file through this endpoint before writing to the dist folder. Cuts CSS payload size without adding a Node minifier dependency.
Inline critical CSS
Minify above-the-fold styles before inlining into the <head>. The minified version keeps your HTML light while preserving the critical-CSS performance benefit.
User-provided theme minification
When letting users submit custom CSS for their profile or page, minify before saving. Reduces DB storage and response-body size when the style ships to the browser.
Frequently asked questions
Is this lossless?
Does it preserve CSS custom properties?
What about CSS-in-JS or Sass/Less?
Are vendor prefixes preserved?
How much savings can I expect?
Get your API key
Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.