CSS Formatter & Minifier
Paste any CSS to instantly beautify it with proper indentation, or minify it to shrink file size for production.
Live CSS Beautifier & Minifier
Format messy, minified, or copy-pasted CSS into clean, readable stylesheets with consistent indentation - or strip whitespace and comments to produce a compact, production-ready file. This free online CSS beautifier and pretty print tool runs entirely in your browser - nothing is uploaded to a server.
Quick answer: to format CSS, paste it below and click Format - the tool re-indents every rule and declaration using your chosen indent size. To shrink it for production, click Minify to strip whitespace and comments while preserving url() paths and string values untouched.
0 characters
Original
0 chars
Output
0 chars
Change
-
Related Developer Tools
Last updated: Jun 11 2026
Reviewed by QuickTooly Team
CSS Formatting Guide
CSS minification (also called compressing or shrinking CSS) removes whitespace, comments, and redundant characters from a stylesheet to reduce its file size without changing how it renders. CSS formatting - also known as beautifying or using a CSS prettifier - does the opposite: it adds consistent indentation and line breaks so the same stylesheet is easy to read and edit.
Why Format or Minify CSS?
CSS you copy from a build tool, browser dev tools, or a teammate is often either inconsistently indented and hard to scan, or already minified into a single line that's impossible to edit. This tool solves both problems in one place:
- Beautify for readability: Re-indent rules, declarations, and nested at-rules with a consistent indent size so you can review and edit stylesheets easily.
- Minify for production: Strip whitespace and comments to reduce file size before shipping a stylesheet.
- Safe with strings and URLs: Quoted string values and
url()paths are left untouched during minification, so fonts, background images, andcontentvalues keep working. - One-click copy: Copy the formatted or minified result straight into your editor.
- Zero install: Works entirely in your browser - no extensions, plugins, or sign-up required.
CSS Formatter & Minifier in Action
Here's a quick example of the same CSS rule before and after running it through this tool:
Before (minified)
.btn{display:inline-flex;align-items:center;padding:8px 16px;border-radius:6px;background:#4ADE80}After (formatted)
.btn {
display: inline-flex;
align-items: center;
padding: 8px 16px;
border-radius: 6px;
background: #4ADE80;
}Formatting vs. Minifying
Formatting and minifying are opposite operations on the same stylesheet - one optimizes for humans, the other for file size.
| Operation | What it does | Best for |
|---|---|---|
| Format | Adds consistent indentation and line breaks for rules and declarations | Reading, editing, and reviewing stylesheets |
| Minify | Removes whitespace, line breaks, comments, and redundant semicolons | Production builds, faster page loads |
Common Use Cases for CSS Formatting & Minification
Pretty printing and compressing CSS solve different everyday problems. Here's when each one comes in handy:
- Cleaning up copy-pasted styles: CSS copied from browser dev tools, a CMS, or a third-party snippet is often a single unreadable line. Pretty print it to review and adapt the rules before reusing them.
- Reviewing generated stylesheets: Format CSS output from a preprocessor or framework to check what's actually being shipped, then minify the final build output.
- Debugging third-party stylesheets: Minified CSS from a competitor's site, a CDN bundle, or an embedded widget is hard to read - beautify it first to inspect selectors and values.
- Shrinking static stylesheets for performance: Compress hand-written CSS for a static site or landing page to cut payload size and improve load times.
What Gets Stripped When Minifying
- Whitespace between rules: line breaks and indentation between selectors, declarations, and blocks are removed.
- Spaces around punctuation: spaces around
{,},:,;, and,are removed. - Trailing semicolons: the last semicolon before a closing
}is removed since it's redundant. - CSS comments:
/* ... */blocks are removed when "Strip comments" is enabled - except license/banner comments that start with/*!, which are preserved.
How to Use This Tool
- Paste your CSS - or click "Load sample" to try it with example styles.
- Choose an indent size - 2 spaces, 4 spaces, or tabs for the formatted output.
- Click Format or Minify - the result appears in the output box, with character counts for both versions.
- Copy the result - click Copy to place it on your clipboard.
CSS Formatting Best Practices
- Pick one indent size and stick to it: 2 spaces is the de-facto standard for CSS, but whatever you choose, keep it consistent across your project so diffs stay clean.
- Format source, minify output: Keep your source stylesheets formatted for readability, and only minify the build output you actually ship.
- Keep license banners when minifying: Use
/*! ... */for copyright or license notices you need to keep in a minified file - this tool preserves them when "Strip comments" is enabled. - Re-check after minifying: Always render or preview minified CSS before deploying - while this tool never touches selectors, properties, or values, it's good practice to confirm the page still looks right.
- Don't minify during development: Minified stylesheets are hard to debug in browser dev tools. Format for local development and minify only as a build step.
Frequently Asked Questions
What's the difference between formatting and minifying?
Formatting (beautifying) adds indentation and line breaks to make CSS easy to read and edit. Minifying does the opposite - it removes whitespace, line breaks, comments, and redundant semicolons to make the file as small as possible for production.
Will minifying break my CSS?
No. This tool only removes whitespace, comments, and redundant punctuation between and around rules - it never changes selectors, properties, or values. String values and url() paths are left exactly as-is, since whitespace and quoting there can be meaningful.
Which indent size should I choose?
2 spaces is the most common convention for CSS, HTML, and JavaScript and is the default in most editors and style guides. Use 4 spaces or tabs if that matches your project's existing code style.
Are license or banner comments removed?
No. Comments starting with /*! are preserved even with "Strip comments" enabled, since these are commonly used for copyright and license notices that need to survive minification.
Does this work with SCSS or LESS?
This tool is built for plain CSS syntax. Standard SCSS and LESS rules will mostly format and minify fine since they share CSS's brace-and-semicolon structure, but preprocessor-specific features like variables, mixins, and nesting shortcuts aren't specially validated.
Does this affect source maps?
This tool doesn't generate or update source maps. If your build pipeline relies on a source map for a stylesheet, regenerate it after minifying with this tool, or minify as part of your existing build step instead.
Is my CSS sent to a server?
No. Formatting and minifying happen entirely in your browser using JavaScript. Nothing you paste here is uploaded or transmitted anywhere.
What's the best indent size for design systems vs. production builds?
For shared design tokens and component stylesheets, 2 spaces keeps deeply nested selectors and media queries readable. For production builds, match whatever convention your team or framework already uses - then minify the final output regardless of indent size, since whitespace is stripped either way.