How to Read and Edit Minified CSS (and Minify It Again)

Turn compressed CSS into readable rules, find the style you need with DevTools and source maps, edit it safely, and minify stylesheets again for production.

Updated September 29, 2026 5 min read

Use the free CSS FormatterBeautify or minify CSS stylesheets

You need to change one colour in a theme, but the only stylesheet you have is style.min.css: tens of thousands of characters on a single line. Or a plugin's CSS is overriding your own and you want to see exactly which rule is responsible. Minified CSS is fast for browsers and unreadable for people, and working in it directly is a good way to break something.

This guide shows how to expand minified CSS into readable rules, how to locate the rule you care about, the small syntax details that bite when you edit compressed CSS, and how to minify it again for production.

What minification removes

A CSS minifier removes everything the browser does not need:

  • comments;
  • line breaks and indentation;
  • spaces around {, }, :, ; and ,;
  • the final semicolon before each closing brace, which is optional in CSS.

More aggressive tools go further, shortening colours (#ffffff to #fff), dropping units from zero values, and merging duplicate rules. The result is the same stylesheet in fewer bytes:

.card{display:flex;gap:1rem;padding:16px 20px}.card:hover{transform:translateY(-2px)}

Formatting reverses the whitespace part:

.card {
  display: flex;
  gap: 1rem;
  padding: 16px 20px
}

.card:hover {
  transform: translateY(-2px)
}

What formatting cannot bring back is anything the minifier deleted: comments, and the original organisation of the file if rules were merged or reordered.

Format or minify CSS with our tool

The CSS Formatter formats with the js-beautify library and minifies with a conservative minifier, entirely in your browser.

  1. Open the CSS Formatter. Paste into CSS input, or click Open file to load a .css, .scss or .less file up to 20 MB. Load sample shows a compressed component stylesheet with a media query.
  2. Choose the Indent size: 2 spaces, 4 spaces or Tab.
  3. Read the Formatted CSS: one selector per block, one declaration per line, with a blank line between rules and nested indentation inside @media blocks.
  4. To compress instead, turn on Minify. Comments, line breaks and spaces around braces, semicolons, commas and after colons are removed, and strings such as content: "New: " are kept exactly.
  5. Copy the result or Download it as styles-formatted.css or styles.min.css (or your file's own name with those suffixes).

The formatter does not reorder or merge anything, so the output behaves exactly like the input. It also does not add semicolons that were missing, which matters when you edit (see below). For a minifier with an option to keep /*! license */ comments, use the CSS Minifier.

Finding the rule you need

Formatting a whole theme gives you thousands of readable lines, but you still have to find the right one. Browser developer tools do most of that work.

Inspect the element

Right-click the element on the page and choose Inspect. The Styles pane lists every rule that applies, in order of priority, with overridden declarations struck through. Next to each rule is the file and line it came from.

Pretty-print in the Sources panel

When the source is minified, the line number is always 1. In Chrome and Edge, open the file in the Sources panel and click the {} (pretty print) button; Firefox's Style Editor and Debugger offer similar formatting. The line references then point into the formatted view.

Look for source maps

If the site was built with Sass, Less or a bundler, it may ship a source map (a .map file referenced at the end of the CSS). Developer tools then show the original source file and line, including the Sass partial, which is far more useful than any reformatted output. If you control the build, enable source maps in development.

Editing compressed CSS safely

Watch the missing semicolons

Minifiers drop the last semicolon in each block. After formatting, the final declaration in each rule has no semicolon. If you add a new line after it without adding one, both declarations break:

.card {
  padding: 16px 20px   /* no semicolon here */
  color: #333;         /* now invalid together with the line above */
}

Add the semicolon to the previous line whenever you append a declaration.

Prefer overriding to editing

Editing a vendor's minified file means your change is lost at the next update. Where possible, add your own stylesheet loaded after it, and override only what you need with a selector of equal or higher specificity. In WordPress and similar systems, use the theme's custom CSS area or a child theme.

Keep a readable master copy

If the minified file is the only copy of your own styles, format it once, save that as the source, and treat the minified file as a build output from now on.

Formatting conventions worth adopting

Consistent formatting makes stylesheets easier to review. Common conventions include:

  • one selector per line when a rule has several selectors;
  • one declaration per line, always ending with a semicolon;
  • a space after the colon (color: #333), none before;
  • lowercase hex colours, and a consistent choice between hex and rgb();
  • related properties grouped together (layout, box model, typography, visuals).

For projects with several contributors, a tool such as Prettier or Stylelint enforces conventions automatically, which beats agreeing on them in code review. When converting between units or colour formats while you tidy, the PX to REM Converter and Color Converter save mental arithmetic.

Minifying for production

Minification reduces the bytes a browser must download before it can render a page, since CSS blocks rendering. The saving is real but smaller once the server compresses files with gzip or Brotli. In a modern build, tools such as Lightning CSS, cssnano or esbuild minify automatically; use a browser tool for one-off files, snippets for a CMS, or quick checks.

If the stylesheet belongs to a page whose HTML also needs tidying, the HTML Formatter handles the markup in the same way.

Frequently asked questions

Can I get the original CSS back from a minified file?

You can get readable CSS back, but not comments or the original file structure, because the minifier deleted them. If a source map is available, developer tools can show the original source.

Does formatting CSS change how the page looks?

No. Whitespace between tokens has no effect on CSS rendering. Our formatter does not reorder or merge rules, so the result behaves identically.

Can it format SCSS or Less?

It accepts .scss and .less files and handles standard nested blocks, but it is a CSS formatter, not a Sass compiler. For heavy use of preprocessor features, use your project's own formatter.

Why is the last declaration in each rule missing a semicolon?

The minifier that produced the file removed it, because it is optional before a closing brace. Add it back before appending new declarations.

Is CSS minification worth it?

Yes, for production files. It is a free saving that build tools apply automatically. Keep the formatted version as your source.

Try it now: CSS Formatter

Loading tool…