CSS Minifier

Minify CSS by removing comments and whitespace.

Input CSS
Minified Output
All examples use BASE_URL — set it to your deployment URL.
POST/api/css/minify
Minify CSS by removing comments, whitespace, and unnecessary characters. Returns size savings.
const BASE_URL = "http://localhost:3000"; const res = await fetch(`${BASE_URL}/api/css/minify`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ css: ".container {\n display: flex;\n /* comment */\n gap: 16px;\n}" }) }); const data = await res.json(); // → { success: true, result: ".container{display:flex;gap:16px}", // original: 58, minified: 33, saved: 25, percentage: 43 }