CraftTools

CSS Minifier & Beautifier

Guide: px vs rem vs em: Which CSS Unit Should You Use?

234 → 172 bytes (26% smaller)

Nothing you enter or choose here leaves your device. This tool runs in your browser.

How to use

  1. 1Choose Minify or Beautify.
  2. 2Paste your CSS into the input box.
  3. 3Check the result and the size saved.
  4. 4Click Copy CSS, or Download .css.

Frequently asked questions

What does the minifier remove?

Comments, line breaks, extra spaces and the last semicolon in each rule, and it turns 0.5em into .5em. Comments that start with /*! are kept because they usually hold licences.

Is it safe for my stylesheet?

It doesn't rewrite values, selectors or colors, and it leaves strings and url() contents untouched. Spaces that matter, such as inside calc() and between selectors, are kept.

Does it combine files or remove unused CSS?

No. It only compresses the text you paste. To remove unused rules or merge files, use a build tool such as PostCSS.

Is my CSS uploaded?

No. It is processed in your browser and nothing is sent anywhere.

Read the guides

Learn how this works and how to get the most from it.

Web & SEO

px vs rem vs em: Which CSS Unit Should You Use?

The difference between px, rem and em in CSS, how to convert between them, and when each one is the right choice.

1 min read

Web & SEO

HTML Entities, Formatting and Minifying Explained

When to escape characters in HTML, how formatting and minifying differ, and how much minifying HTML, CSS and JavaScript really saves.

1 min read

JavaScript Minifier

Strip comments and spaces from JavaScript. Safe and private.

HTML / XML Formatter & Minifier

Beautify or minify HTML and XML.

CSS Gradient & Box Shadow Generator

Design gradients and box shadows visually and copy the CSS.

PX to REM Converter

Convert px to rem, em, pt and percent for any base font size.