# Minification

Category: [Performance & Core Web Vitals](https://seo-geo-glossary.com/en/glossary/category/performance-core-web-vitals/) › [Optimization](https://seo-geo-glossary.com/en/glossary/category/performance-core-web-vitals/optimization/) · Also known as: minify, code minification

**Minification** is the process of removing unnecessary or redundant data from a resource without changing how the browser processes it (MDN). For HTML, CSS and JavaScript, that means removing comments, whitespace and line breaks, and in JavaScript often shortening variable and function names. The goal is a smaller file that downloads faster.

## How does minification work?

Minification is usually an automated build step. Developers keep readable source files, and the build produces minified versions for the live site. Browser developer tools can add whitespace back with a "prettify" function, and source maps link minified code to the original files for debugging (MDN, Wikipedia).

Lighthouse has audits for this: "Minify CSS" reports unminified CSS files and estimates the savings in KiB, and a parallel "Minify JavaScript" audit exists for JavaScript. For CSS, minifiers also apply shorthand such as turning `#000000` into `#000`.

## How does it differ from compression and obfuscation?

- **Compression** (gzip, Brotli) encodes the file for transfer, and the browser has to decompress it. Minified code needs no extra step because it runs as is. The two effects add up (web.dev).
- **Obfuscation** aims to make code hard to read. Minification aims for a smaller file, and its output is often reversible with a pretty-printer (Wikipedia).

## Example

Before:

```css
/* Primary button */
.button {
  color: #000000;
  margin: 0px;
}
```

After:

```css
.button{color:#000;margin:0}
```

## Common questions

**Does minification change how a page looks?** It should not. If a build step breaks a script, that points to a tooling problem.

**Which tools are used?** Google's older PageSpeed Insights documentation names HTMLMinifier for HTML, cssnano and csso for CSS, and UglifyJS and Closure Compiler for JavaScript. Many CMS plugins and CDNs offer the same function.

## Related terms

- [Web performance](https://seo-geo-glossary.com/en/glossary/web-performance/index.md)
- [Render-blocking resources](https://seo-geo-glossary.com/en/glossary/render-blocking-resources/index.md)
- [Critical CSS](https://seo-geo-glossary.com/en/glossary/critical-css/index.md)
- [Compression (Gzip/Brotli)](https://seo-geo-glossary.com/en/glossary/compression/index.md)
- [Lighthouse](https://seo-geo-glossary.com/en/glossary/lighthouse/index.md)

## Sources

- [Minification – MDN Web Docs](https://developer.mozilla.org/en-US/docs/Glossary/Minification)
- [Minify CSS – Lighthouse, Chrome for Developers](https://developer.chrome.com/docs/lighthouse/performance/unminified-css)
- [Reduce network payloads using text compression – web.dev](https://web.dev/articles/reduce-network-payloads-using-text-compression)
- [Minification (programming) – Wikipedia](https://en.wikipedia.org/wiki/Minification_(programming))
- [Minify Resources (HTML, CSS, JavaScript) – Google PageSpeed Insights docs (deprecated API v4, definition and tool list only)](https://developers.google.com/speed/docs/insights/MinifyResources)

---

Last updated: October 7, 2026
URL: https://seo-geo-glossary.com/en/glossary/minification/
