CSS Minifier & Beautifier

Minify CSS to make your pages load faster, or beautify minified CSS so it is easy to read and edit. See exactly how many bytes you save, then copy or download the result.

  • 100% free
  • No sign-up
  • Runs in your browser

Paste your CSS

Beautify indent
Beautify layout

Updates as you type. Strings, url() values, calc() spacing and !important are kept exactly right.

Result

Your minified or beautified CSS and the size saved will appear here. Paste some CSS or try the example.

About the tool

How the CSS Minifier & Beautifier works

The CSS Minifier & Beautifier turns your stylesheets into whichever form you need. Paste CSS or drop a .css file, then press Minify to get the smallest version for your website, or Beautify to turn a squashed, one-line file into neatly indented code you can read and edit. The result updates as you type and shows the size before and after, so you can see exactly how many bytes you saved.

Minifying removes comments, line breaks and spaces that browsers don't need, drops the last semicolon in each block, removes empty rules and shortens numbers such as 0.5 to .5. It is careful about the places where spaces matter: text inside quotes and url() is never changed, the spaces around + and - inside calc() are kept, and a space before a colon in a selector (as in div :first-child) stays, because removing it would change which elements match. Comments that start with /*! are kept by default, because that is how libraries mark their licence.

Beautifying puts each selector and each declaration on its own line, adds a space after colons and commas, and indents @media, @supports, @keyframes and nested rules with 2 spaces, 4 spaces or tabs. Choose the One rule per line layout instead to keep each selector and its declarations on a single line, which makes long stylesheets easy to scan. You can copy the result or download it as a .min.css or .css file. Everything runs in your browser, so private or unreleased code never leaves your device.

Frequently asked questions

Is my CSS uploaded anywhere?

No. Minifying and beautifying happen in your browser on your own device. Your CSS is never sent to a server, so it's safe to use with private or unreleased code.

Can minifying break my CSS?

It is designed not to. The minifier only removes what browsers ignore: comments, extra whitespace, the last semicolon in a block and empty rules. Strings, url() values and the spaces calc() needs are kept. It doesn't merge rules or rewrite colours, which keeps it predictable. If your CSS has an unclosed bracket, string or comment, you'll see a warning with the line number.

How much smaller will my file get?

It depends on how the CSS is written. Well-commented, indented stylesheets usually shrink by about 15 to 35 percent. Your web server's gzip or Brotli compression then makes the download smaller still.

What are /*! comments and why are they kept?

Many libraries put their licence in a comment that starts with /*! so tools know to keep it. The minifier keeps these by default; untick the option if you want every comment removed.

Does it work with SCSS or Less?

Plain CSS is what it is built for. Simple SCSS that looks like CSS, including nested rules, usually formats fine, but features such as // line comments, mixins and @if blocks are not fully understood. For those, compile to CSS first.

Keep exploring
  • Free
    Developer

    Word to HTML Converter

    Turn Word documents (.docx) or text pasted from Word into clean HTML or Markdown for any website, CMS or email.

    • DOCX to HTML
    • Markdown
    • Paste from Word
  • Free
    Developer

    JSON Formatter & Validator

    Format, validate and minify JSON, find errors by line, fix common mistakes, browse a tree view or convert to CSV.

    • Beautify
    • Validate
    • JSON to CSV
  • Free
    Developer

    Base64 & URL Encoder / Decoder

    Encode and decode Base64 text and files, turn images into data URIs, and encode, decode or parse URLs.

    • Base64
    • Data URI
    • URL decode
For makers

Have an AI Tool?

Submit your AI tool and help others discover it.