Beautify or minify CSS with 2-space, 4-space, or tab indentation. See the exact byte savings percentage after minifying β copy the result with one click.
Paste CSS and choose Beautify or Minify
CSS formatting expands compressed selectors and declarations into a readable stylesheet. Minification performs the opposite transformation by removing comments, collapsing whitespace, and tightening punctuation.
| Mode | Best for | Result |
|---|---|---|
| Beautify | Editing and review | Indented selectors and declarations |
| Minify | Delivery and caching | Smaller, compact stylesheet |
Beautify mode is easier to scan when checking cascade behavior, media queries, and repeated declarations. Minify mode is useful after editing, but production build tools usually provide stronger optimization, source maps, and syntax validation.
Input:
.card{color:#334155;padding:1rem}.card:hover{color:#4f46e5}
Beautified:
.card {
color: #334155;
padding: 1rem
}
.card:hover {
color: #4f46e5
}
The formatter is intentionally lightweight and does not parse every CSS dialect. Standard CSS is supported; SCSS nesting, Less mixins, and other preprocessor features should be checked with a parser after transformation.
JavaScript:
const compact = css
.replace(/\/\*[\s\S]*?\*\//g, "")
.replace(/\s+/g, " ")
.trim();
Python:
import re
compact = re.sub(r"/\*[\s\S]*?\*/", "", css)
compact = re.sub(r"\s+", " ", compact).strip()
Processing runs locally in the browser; pasted CSS is not uploaded. Because this is a lightweight formatter rather than a complete CSS parser, inspect output containing strings, custom properties, comments, or preprocessor syntax before shipping it.
This tool is provided for general informational and utility purposes only. Results may be inaccurate, incomplete, outdated, or contain errors. Always verify results before relying on or using them.
Some tools may use AI, automated processing, third-party services, or server-side processing. Do not rely on these tools as a substitute for professional advice.
Use at your own risk. BestToolOnline makes no guarantees regarding the accuracy, reliability, completeness, availability, or suitability of results, to the maximum extent permitted by applicable law.
See our Terms of Service and Privacy Policy for complete details.