Shrinking a stylesheet before shipping without a build step
A landing page or email template served without a bundler still benefits from minification. Typical savings are 15–25% before compression.
Minifies or beautifies CSS to reduce size or improve readability.
Minifies or beautifies CSS to reduce size or improve readability.
body { color: red; margin: 0px; }body{color:red;margin:0}Whitespace and redundant units are removed.
Minified CSS is functionally identical with reduced whitespace.
Your input is sent to YAS infrastructure because the tool requires server-side processing or public network queries. Input is not stored.
curl -X POST "https://yas.sh/api/v1/tools/css-minifier" \
-H "Content-Type: application/json" \
-d '{"input":"body { color: red; }","mode":"minify"}'const res = await fetch("https://yas.sh/api/v1/tools/css-minifier", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"input": "body { color: red; }",
"mode": "minify"
}),
});
const data = await res.json();import requests
r = requests.post("https://yas.sh/api/v1/tools/css-minifier", json={"input":"body { color: red; }","mode":"minify"})
data = r.json()| Field | Type | Required | Description |
|---|---|---|---|
| input | string | Yes | CSS text |
| mode | string | No (default minify) | minify | beautify |
{ "result": "body{color:red}", "mode": "minify", "savings": 9 }Minify or beautify CSS (mode: minify | beautify).
400 VALIDATION_ERROR — invalid input or unsupported option.413 PAYLOAD_TOO_LARGE — input exceeds the 64 KB limit.429 RATE_LIMIT_EXCEEDED — rate limit exceeded (60 req/min).Minification tokenises the stylesheet and re-emits it without the bytes that carry no meaning to the parser: comments, whitespace between tokens, the final semicolon in a block, leading zeros in decimals (0.5em → .5em), and redundant units on zero values (0px → 0). Colour literals are shortened where an equivalent shorter form exists — #ffffff to #fff — and quotes are removed from url() where the target needs no escaping.
None of these transformations reorder or merge rules, and that restraint is intentional. Merging duplicate selectors or dropping apparently-overridden declarations changes cascade behaviour whenever specificity, source order or a later stylesheet is involved. A minifier that is safe is one that only removes bytes the CSS grammar treats as insignificant.
A landing page or email template served without a bundler still benefits from minification. Typical savings are 15–25% before compression.
Reading a vendor's compiled CSS to find which rule is overriding yours is far easier once the file has line breaks and indentation.
Above-the-fold CSS inlined as minified text removes a render-blocking request. Keep it small — every byte is uncached and repeated on every page load.
Normalising both files through the same formatter makes a diff show real rule changes instead of formatting noise from different toolchains.
What this tool deliberately does not do, and where it will disagree with other implementations.