CSS minifier & Beautifier

Compress, optimize, and format CSS code

Overview

The CSS Minifier & Beautifier is a dual-mode tool for processing CSS stylesheets. Minify mode compresses CSS for production by removing whitespace and optimizing values. Beautify mode formats compressed CSS into readable, properly indented code. Both modes offer extensive customization through options panels and real-time statistics.

Minify
Compress CSS, remove whitespace, optimize values
Beautify
Format CSS with proper indentation and line breaks
Options
Fine-tune compression and formatting behavior
Stats
Real-time INPUT, OUTPUT, and SAVED percentage

Processing modes

At the top of the interface, you'll find the Processing mode section with two mode buttons. Each mode has different options and produces different output.

1

Minify mode button

Click Minify (with compress icon) to switch to compression mode. The button shows Compress CSS as its description. When active, the button is highlighted.

2

Beautify mode button

Click Beautify (with magic wand icon) to switch to formatting mode. The button shows Format CSS as its description. When active, the button is highlighted.

3

Minify/Beautify options

Each mode shows different options panels below the mode buttons:
Minify shows: MINIFY OPTIONS + OPTIMIZATION
Beautify shows: INDENTATION + COMMENTS & ORDER

Both modes have an Advanced options section that expands for more settings.

4

Input CSS

The left panel labeled Input CSS is where you enter or paste your CSS code. You can also drag and drop .css files onto the drop zone, or use the Upload/Paste buttons.

5

Output CSS

The right panel labeled Output CSS displays the processed result. After minifying or beautifying, your CSS appears here with syntax highlighting.

6

Auto-process checkbox

At the bottom left, the Auto-process checkbox enables automatic processing as you type or paste. When enabled, you don't need to click the MINIFY/BEAUTIFY button.

7

Statistics & Favorites

The stats bar at the bottom shows INPUT size, OUTPUT size, and SAVED percentage. On the right edge, find the Favorites tab (heart icon) to add this tool to your favorites.

CSS Minifier interface overview showing processing modes, options, input/output panels, and statistics
Complete interface with processing modes, options, and statistics

Minify mode Compress CSS

Minify mode compresses your CSS for production use. It removes unnecessary whitespace, optimizes values, and can remove empty rules - all while preserving CSS functionality.

1

Select Minify mode

Click the Minify button in the Processing mode section. The button is highlighted when active.

2

Enter your CSS

Paste CSS into the Input CSS panel, or drag and drop a .css file onto the drop zone. You can also click Upload to select a file, or Paste to paste from clipboard.

3

Configure options

Adjust the MINIFY OPTIONS and OPTIMIZATION panels as needed. Click Advanced options to expand additional settings. These control what gets preserved and removed.

4

Click MINIFY (or Auto-process)

Click the orange MINIFY button in the center, or enable Auto-process at the bottom to minify automatically when you paste or type. The compressed CSS appears in the Output panel.

5

Check savings

Look at the SAVED percentage in the stats bar (bottom right). This shows how much smaller your CSS became. Typical savings are 20-50% depending on original formatting.

6

Copy or download

Click Copy to copy the minified CSS to your clipboard, or Download to save as a .min.css file. The output is ready for production use.

CSS Minifier in Minify mode with minified output
Minify mode with compressed CSS output
Minification example
/* Before: 186 bytes */
.button {
    background-color: #ffffff;
    padding: 10px 20px;
    margin: 0px;
    border-radius: 4px;
}

/* After: 73 bytes (61% saved) */
.button{background-color:#fff;padding:10px 20px;margin:0;border-radius:4px}

MINIFY OPTIONS Minify Mode

The MINIFY OPTIONS panel controls which elements are preserved during compression. These checkboxes appear when Minify mode is active.

1

Keep important comments (/*! */)

When enabled, preserves comments starting with /<em>!. These are typically license headers or critical documentation that shouldn't be removed.
Example: /</em>! Bootstrap v5.0 | MIT License */ stays intact.

2

Normalize values (#ffffff to #fff, 0px to 0)

When enabled, shortens values where possible:
#ffffff = #fff
#aabbcc = #abc
0px = 0
0.5em = .5em

This produces smaller output without changing visual appearance.

MINIFY OPTIONS panel with checkboxes
MINIFY OPTIONS with important comments and normalize values

OPTIMIZATION Minify Mode

The OPTIMIZATION panel provides additional compression options that go beyond basic whitespace removal.

1

Remove empty rules

When enabled, removes CSS rules that have no declarations. For example, .empty { } is completely removed. This cleans up CSS that may have had all properties deleted during editing.

2

Keep vendor prefixes

When enabled, preserves vendor-specific prefixes like -webkit-, -moz-, -ms-. These are needed for cross-browser compatibility.
Recommended: Keep this enabled unless you're using autoprefixer in your build process.

OPTIMIZATION panel with checkboxes
OPTIMIZATION settings for empty rules and vendor prefixes

Minify Advanced options Expandable

Click Advanced options to expand additional minification settings. These provide fine-grained control for specific use cases.

1

Preserve all comments

When enabled, keeps ALL comments in the output, not just important ones. Use this when you need comments for documentation but still want whitespace removal.

2

Keep @charset

When enabled, preserves @charset declarations at the start of your CSS. These specify character encoding (e.g., @charset "UTF-8";). Usually safe to keep enabled.

3

Preserve newlines between rules

When enabled, keeps line breaks between CSS rules while still removing other whitespace. Makes minified CSS slightly more readable without significant size increase.

4

Sort selectors

When enabled, alphabetically sorts selectors within grouped rules. For example, .z, .a, .m { } becomes .a, .m, .z { }. Helps with consistency and diff comparisons.

5

Alphabetize declarations

When enabled, sorts CSS properties alphabetically within each rule. { z-index: 1; color: red; } becomes { color: red; z-index: 1; }. Useful for maintaining consistent property order.

Minify Advanced options panel expanded
Advanced options for minification

Beautify mode Format CSS

Beautify mode transforms minified or poorly formatted CSS into clean, readable code with proper indentation and line breaks. Essential for editing compressed stylesheets.

1

Select Beautify mode

Click the Beautify button in the Processing mode section. The button is highlighted when active.

2

Enter minified CSS

Paste compressed or unformatted CSS into the Input CSS panel. This could be:
Minified production CSS
Copy-pasted CSS from browser DevTools
Poorly formatted legacy code

3

Configure formatting

Adjust the INDENTATION and COMMENTS & ORDER panels. Choose your preferred indentation style and whether to preserve comments.

4

Click BEAUTIFY

Click the green BEAUTIFY button. Your CSS is formatted with proper indentation, line breaks, and consistent spacing. Each rule is on its own line.

5

Check formatted output

Review the Output CSS panel to verify the formatting looks correct. Check that indentation matches your preference and comments are preserved as expected.

6

Copy or download

Click Copy to copy the beautified CSS to your clipboard, or Download to save as a .css file. It's now ready for editing, debugging, or adding to your source files.

CSS Minifier in Beautify mode with formatted output
Beautify mode with properly formatted CSS output
Debugging production CSS
Need to debug minified CSS from a production site? Paste it here and beautify to make it readable. Then you can find and understand the rules causing issues.

INDENTATION Beautify Mode

The INDENTATION panel controls how your beautified CSS is formatted. These options appear when Beautify mode is active.

1

Indentation dropdown

Click the dropdown (default: 2 spaces) to choose indentation style:
2 spaces: Compact, common in modern web development
4 spaces: More visual separation, traditional style

2

One declaration per line

When enabled, each CSS property appears on its own line - for example .box { color: red; padding: 10px; } is formatted with one property per line instead of all on one line.

When disabled, multiple properties may share a line. Recommended: Keep enabled for best readability.

INDENTATION panel with dropdown and checkbox
INDENTATION settings with spaces and one declaration per line

COMMENTS & ORDER Beautify Mode

The COMMENTS & ORDER panel controls how comments and rule order are handled during beautification.

1

Preserve comments (Important only)

When enabled, preserves comments in your CSS.
The "Important only" setting means only /<em>! important comments </em>/ are kept.
Regular /<em> comments </em>/ are removed. Disable to strip all comments.

2

Keep original order

When enabled, CSS rules stay in their original order. The cascade depends on rule order, so changing order can affect how styles apply. Recommended: Keep enabled to avoid unexpected style changes.

COMMENTS & ORDER panel with checkboxes
COMMENTS & ORDER settings for beautification

Input & Output panels

The main interface has two side-by-side panels for entering CSS and viewing processed results.

1

Input CSS panel

The left panel labeled Input CSS (with code brackets icon) is where you enter your CSS. It shows a drop zone with:
Cloud upload icon
Text: Drop CSS files here or start typing
CSS badge indicating file type

Input CSS panel with drop zone
Input CSS panel for entering or dropping CSS files
2

Input action buttons

Above the input panel, find action buttons:
Upload: Open file picker to load a .css file
Paste: Paste CSS from clipboard
Wrap: Toggle line wrapping in the input area
Clear: Clear the input panel

Input action buttons: Upload, Paste, Sample, Clear
Input panel action buttons
3

Main action button

Between the panels, the main action button:
MINIFY: When in Minify mode
BEAUTIFY: When in Beautify mode

Click to process your CSS, or enable Auto-process for automatic processing.

4

Swap button

Below the main action button, find a swap icon (two arrows). Click to swap input and output - useful when you want to re-process the result or reverse an operation.

Main action button and swap button between panels
MINIFY/BEAUTIFY button and swap functionality
5

Output CSS panel

The right panel labeled Output CSS (with magic wand icon) shows processed results. Before processing, it shows: Processed CSS will appear here...

Output CSS panel with processed result
Output CSS panel displaying processed CSS
6

Output action buttons

Above the output panel:
Copy: Copy processed CSS to clipboard
Download: Save as .css or .min.css file

Output action buttons: Copy and Download
Output panel action buttons

Auto-process & Stats bar Real-time

The bottom of the interface provides automatic processing and real-time statistics about your CSS.

1

Auto-process checkbox

On the bottom left, find the Auto-process checkbox. When enabled:
CSS is processed automatically as you type or paste
No need to click the MINIFY/BEAUTIFY button
Results update in real-time

Disable for large files where you want manual control.

2

INPUT stat

Shows the size of your input CSS in bytes. Updates as you type or paste. Helps you understand the original file size.

3

OUTPUT stat

Shows the size of the processed CSS in bytes. Compare with INPUT to see the size difference.

4

SAVED percentage

Displays the percentage reduction (for Minify) or indicates formatting was applied (for Beautify). For example:
45% means the output is 45% smaller than input
0% means sizes are equal

Auto-process checkbox and statistics bar showing INPUT, OUTPUT, and SAVED
Auto-process toggle and real-time statistics

What minification does

Here's exactly what gets removed or changed during CSS minification:

Removes comments
All / comments / are removed unless you enable "Keep important comments" for /! / or "Preserve all comments".
Removes whitespace
Spaces, tabs, and line breaks are removed wherever not needed. Multiple spaces become one or zero.
Shortens colors
#ffffff = #fff, #aabbcc = #abc when "Normalize values" is enabled. Same colors, fewer characters.
Optimizes values
0px = 0, 0.5 = .5 when "Normalize values" is enabled. Removes unnecessary units and leading zeros.
Removes empty rules
CSS rules with no properties (.empty { }) are removed when "Remove empty rules" is enabled.
Sorts selectors/properties
Advanced options can alphabetically sort selectors and declarations for consistency.

Best practices

Keep source files readable
Always work with beautified, commented source CSS. Minify only for production deployment. Never edit minified files directly - always edit the source.
Use .min.css naming
Name minified files with .min.css extension:
styles.css (source) = styles.min.css (production). Makes it clear which is which.
Preserve important comments
Keep "Keep important comments" enabled to preserve license headers. Removing license comments from third-party CSS may violate licensing terms.
Test after minifying
Always test your site with minified CSS before deploying. Verify that styles still work correctly, especially vendor-prefixed properties.
Automate for production
For production websites, use build tools (webpack, Vite, gulp) to minify automatically. This tool is great for quick tasks and one-off processing.
Use Beautify for debugging
When debugging production issues, paste the minified CSS and beautify it. This makes finding specific rules much easier.

Frequently asked questions

Typical reduction is 20-50%, depending on how commented and formatted your original CSS is. Heavily commented files see the biggest reduction. Check the SAVED percentage in the stats bar for exact savings.
Proper minification should never break valid CSS. If something breaks, there was likely a syntax error in the original. Check for missing semicolons, braces, or invalid property values.
Minify compresses CSS by removing whitespace and optimizing values - use for production. Beautify expands compressed CSS with proper formatting - use for development and debugging.
Yes, keep "Keep vendor prefixes" enabled unless you're using autoprefixer in your build process. Vendor prefixes (-webkit-, -moz-, etc.) are needed for cross-browser compatibility.
Comments starting with /! are considered 'important'. They typically contain license information that legally must be preserved.
Example: /
! MIT License */. Enable 'Keep important comments' to preserve these.
Auto-process works with any size file, but may cause lag with very large stylesheets. For files over 100KB, consider disabling Auto-process and clicking MINIFY/BEAUTIFY manually.
It shortens values without changing appearance: #ffffff becomes #fff, 0px becomes 0, 0.5em becomes .5em, rgb(255,255,255) may become #fff. These are equivalent values in fewer characters.
This tool processes one CSS input at a time. For batch processing, use build tools or concatenate your files first. You can paste multiple files' contents into the input.
Yes, all processing happens locally in your browser. Your CSS is never sent to any server. You can use this tool offline after the initial page load.
Sorting creates consistent output regardless of how the original was written. This makes version control diffs cleaner and helps teams maintain consistent code style.

Ready to optimize your CSS?

Minify for production or beautify for editing - with full control over options.

Open CSS Minifier

Documentation