Skip to tool
Web engineering

CSS Beautifier & Minifier

Format, diagnose, and minify CSS with syntax-aware processing.

Input0 characters
Result0 characters
Ready

Prefer a native workflow?

Keep CSS Beautifier & Minifier one shortcut away.

DevSexy for Mac puts the same private workflow in a focused desktop app, with global shortcuts and no browser tab to manage.

Global shortcutOffline-readyLocal processing
Try the Mac app free

This browser tool remains free.

Three operations · three different promises

Choose how much the machine may change.

Formatting, diagnosis, and minification begin with the same parsed stylesheet, then take different exits. Pick the result you need before you judge its output.

01

Format

AST → readable CSS

Stable indentation and wrapping

02

Diagnose

Parser → evidence

Syntax signals and an honest boundary

03

Minify

Tokens → fewer bytes

Comments and whitespace reduced

Modern CSS stress sheet

A useful formatter must survive today’s grammar.

These specimens exercise rule nesting, layers, custom properties, feature queries, calculations, and perceptual color—not just twenty-year-old declarations.

@layer

@layer components { … }

Cascade layer order remains authored

Nesting

.card { &:hover { … } }

The parent selector stays attached

Tokens

:root { --space: 1rem; }

Custom property names are preserved

@supports

@supports (color: oklch(0 0 0))

Conditional rules remain nested

Math

width: calc(100% - var(--space))

Expression spacing becomes legible

Color

color: oklch(72% .18 145)

Modern function tokens stay intact

Byte-budget waterfall

Smaller is a sequence, not a synonym for prettier.

Formatting may grow a file. Minification removes syntax that is unnecessary for delivery while this page deliberately disables rule restructuring.

Authored

100%

Original whitespace, comments, and line breaks

Formatted

≈ 116%

Readable reprint; byte growth is expected

Minified

≈ 64%

Whitespace collapsed; safe token rewrites

Restructured

Not here

Selector/rule reordering is intentionally disabled

Parser breadcrumb

Fix the first broken boundary.

An unclosed block changes how every later token is read. The earliest parser location is more useful than a generic “invalid CSS” banner.

ParseError · the block opened on line 1 never closes
.card {
  color: var(--ink);
  &:hover {
    color: oklch(70% .2 145);
  /* missing closing braces */

Close the nested rule, then the parent rule. Re-run diagnosis before changing declarations downstream.

Cascade boundary court

What a successful parse still cannot prove

OUTSIDE FORMATTER JURISDICTION
01

Specificity intent

Valid selectors can still override the wrong rule.

02

Unused selectors

A formatter cannot observe the DOMs your app renders.

03

Browser support

Parsing modern syntax does not establish target support.

04

Visual equivalence

Only rendering and regression tests can judge the pixels.

Run a reproducible example

Compare readable CSS formatting with conservative minification on a small rule.

Using an example replaces the current input, reference input, operation, and options. Public demonstration data only.

Indent a grid rule

Two spaces and a 100-column wrap; formatting does not execute the stylesheet.

Input

.card{display:grid;gap:1rem}

Declarations remain readable in their original rule.

.card {
  display: grid;
  gap: 1rem;
}

Shorten a plain color rule

Choose the conservative preset for a small rule with white and a zero margin.

Input

.card { color: #ffffff; margin: 0px; }

Inspect the compact result and shortened hexadecimal value before replacing the source.

.card{
#fff

Continue with a related task

SCSS Formatter

Format nested Sass syntax into a stable, reviewable structure.

LESS Formatter

Format LESS variables, mixins, nesting, and rules without compiling.

Color Space Converter

Convert modern CSS colors and check readable contrast across spaces.

Repeat the task in DevSexy for Mac

Use the native app for repeated offline work and direct Option shortcuts.

Direct answer

What is CSS Beautifier & Minifier?

Format CSS online with syntax-aware Prettier/PostCSS diagnostics, or minify it in a Web Worker without uploading source or claiming to audit the cascade.

What can it do?

  • Format
  • Diagnose
  • Minify

How to use CSS Beautifier & Minifier

  1. 01

    Prepare the input

    Paste CSS separately from SCSS or Less source.

  2. 02

    Choose the operation

    Choose Format, Diagnose, or an explicit minification preset.

  3. 03

    Review the evidence

    Review warnings and test the result in the intended browsers and cascade context.

Frequently asked questions

Does the formatter compile SCSS or Less?
No. This page handles CSS. The dedicated SCSS and Less pages preserve those source languages, and neither replaces the corresponding compiler.
Does minification prove the stylesheet renders identically?
No. Optimizer policies can alter representation and depend on their assumptions. Review the diff and test affected rules in the real application and target browsers.
Are compatibility diagnostics a complete support database?
No. Treat reported features as review leads. Browser versions, cascade layers, feature combinations, and fallback behavior need their own rendered checks.