webdev_css_beautifier
Beautify minified or messy CSS by re-indenting, adjusting spacing, and optionally sorting properties. Get readable CSS with configurable formatting options.
Instructions
CSS Beautifier. Pretty-print and re-indent minified or messy CSS with configurable indent size and type (spaces or tabs), brace/colon spacing, blank lines between rules, comment preservation, alphabetical property sorting, and a final-newline toggle. Use it to make CSS readable; use webdev_css_minifier for the inverse (strip whitespace to shrink for production), and webdev_code_formatter when you need HTML, CSS, or JS handled in one multi-language pass. Runs locally via a Node bridge on the CSS you provide: read-only, non-destructive, idempotent, offline, contacts no external service, and is rate-limited (anonymous 60/min, 500/hr, 2000/day). Returns the beautified CSS plus original/beautified byte sizes and the size-change delta and percentage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| css | Yes | The CSS source to beautify. Must be non-empty. | |
| indentSize | No | Spaces per indent level; ignored when indentType is "tabs". | |
| indentType | No | Indent with spaces or a tab character. | spaces |
| newlineBeforeRule | No | Insert a blank line before each selector and comment block. | |
| newlineAfterRule | No | Put the opening brace and closing brace on their own lines. | |
| newlineBeforeProperty | No | Indent each declaration on its own line. | |
| spaceAfterColon | No | Add a space after the colon in each declaration. | |
| spaceBeforeBrace | No | Add a space between the selector and the opening brace. | |
| preserveComments | No | Keep CSS comments; when false they are dropped. | |
| sortProperties | No | Sort declarations alphabetically within each rule. | |
| insertFinalNewline | No | Ensure the output ends with a trailing newline. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| original | No | The original CSS, trimmed and echoed back. | |
| beautified | No | The formatted, re-indented CSS. | |
| originalSize | No | Original CSS length in characters. | |
| beautifiedSize | No | Beautified CSS length in characters. | |
| sizeChange | No | beautifiedSize minus originalSize (negative when smaller). | |
| changePercentage | No | Percent size change relative to the original (2-decimal rounded). | |
| options | No | The normalized options actually applied (defaults filled in). |