CSS Minifier
Minify CSS code to reduce file size and improve page load times. Free, fast, and runs in your browser.
Input CSS
Minified CSS
How to Use the CSS Minifier
Paste your CSS code into the left input panel. The minified output appears automatically in the right panel as you type — there is no button to press. Once the result is ready, check the byte count comparison displayed below the panels to see exactly how much space you saved. Click the Copy button to copy the minified CSS to your clipboard in one click, then paste it directly into your project or CDN configuration.
If you need to start fresh, clear the input panel and paste a new stylesheet. The tool handles stylesheets of any size and works entirely in your browser — no file size limits imposed by server uploads, and no waiting for a round trip to a remote API. For the reverse workflow — turning compressed CSS back into readable code — use our CSS Formatter. If you are working with colors in your stylesheet and need to convert between formats, the Color Converter is a useful companion tool.
What is CSS Minification?
CSS minification is the process of removing every character from a stylesheet that is not required for the browser to interpret it correctly. The characters that get stripped fall into several categories: leading and trailing whitespace, newlines between rules, spaces around colons and braces, CSS comments (both single-block /* ... */ and multi-line variants), and redundant semicolons before closing braces.
Beyond simple whitespace removal, a good minifier also applies shorthand conversions where safe — for example collapsing margin: 0px 0px 0px 0px to margin:0. Crucially, what does not change is anything the browser actually reads: selectors, property names, property values, media query conditions, keyframe names, and pseudo-class syntax all remain byte-for-byte identical. Minification is therefore a completely lossless transformation — the rendered output of the page will be indistinguishable from the original.
Why Minify CSS?
- Faster page loads — Smaller files download faster, especially on mobile networks.
- Lower bandwidth costs — Reduced file sizes mean less data transfer.
- Better Core Web Vitals — Smaller CSS files improve FCP and LCP scores.
- Production best practice — All major frameworks minify CSS for production builds.
Common Use Cases
The most frequent use case is preparing a stylesheet for production deployment. When you run a manual build or are working outside an automated pipeline, this tool gives you an instant minified file without installing any build tooling. Paste the output of your SCSS or PostCSS compiler and get a deployment-ready stylesheet in seconds.
Another common scenario is reducing CSS bundle size for a CDN. If you self-host a third-party library — an icon font stylesheet, a grid framework, or a component library — you can paste the vendor CSS here and serve a smaller file from your own CDN origin. This is also useful when optimizing HTML email templates, where inline CSS must be as compact as possible to avoid clipping by email clients like Gmail that truncate messages above a byte threshold.
Developers also use this tool to compare file size before and after a stylesheet refactor. Paste the old version, note the minified byte count, then paste the refactored version and compare — an objective measure of whether the refactor actually reduced weight or just moved code around.
Best Practices & Tips
Always keep the unminified source in version control. Commit your readable .css or .scss source files, never the minified output. Minified CSS is a build artifact, not source code — treat it the same way you treat compiled JavaScript bundles.
Minify as part of your build pipeline, not manually. Tools like Vite, webpack, and Parcel minify CSS automatically during production builds. Use this tool for one-off tasks or when working outside a build system, but for anything you deploy regularly, integrate minification into your CI/CD process so it happens automatically every time.
Always test after minification. Run a visual diff or load the page in the browser after switching to the minified version. Edge cases in complex selectors or keyframe animations can occasionally be affected by aggressive optimizations in some minifiers.
Combine minification with gzip or Brotli compression. Minification and transport compression work at different levels and are complementary — minification reduces the uncompressed file size, while gzip/Brotli compress the bytes over the wire. Together they typically achieve 70–85% total size reduction compared to the original formatted file.
Consider removing unused CSS first. Before minifying, running a tool like PurgeCSS to strip selectors that do not match any HTML in your project can yield far greater savings than minification alone, especially when you are including a large utility framework like Tailwind or Bootstrap.
Related Guides
- CSS Minification Explained — why and how to minify CSS for production
- How to Format and Beautify CSS — the reverse workflow for development
- CSS Performance: Core Web Vitals — measure the real impact on page speed
FAQ
Is my CSS safe?
Yes. All minification happens in your browser. No CSS is sent to any server.
Will minification break my CSS?
No. The minifier only removes whitespace, comments, and redundant characters. It does not change selectors, properties, or values.
How much can I save?
Typical savings range from 15–40% depending on how the original CSS is formatted. Heavily commented or hand-formatted stylesheets will see the largest reductions. Combined with gzip compression, total transfer savings can reach 70–85%.
Can I minify SCSS or LESS?
No, this tool works with plain CSS only. Compile SCSS or LESS to standard CSS first, then paste the output here to minify.
Should I minify CSS for development?
No. Keep CSS readable during development so you can debug and iterate quickly. Minify only for production deployments.
Related Articles
How to Format and Beautify CSS: A Complete Guide
Learn how to format and beautify CSS with Prettier, Stylelint, and online tools. Covers indentation rules, property ordering, and team standardization.
CSS Performance: Core Web Vitals Workflow for Devs
A framework-agnostic guide to measuring and fixing CSS performance. Read PageSpeed audits, inline critical CSS, eliminate render-blocking, and automate with PostCSS cssnano.
CSS Minification Explained: Why and How to Minify CSS
Learn what CSS minification is, why it matters for web performance, and how to minify CSS effectively. Includes examples and best practices.