# Minify Resources (HTML, CSS, and JavaScript)

> [!CAUTION]
> **Deprecated** . This page was written for version 4 of the PageSpeed Insights API, which is deprecated and will be shut down in May 2019. [Version 5](https://developers.google.com/speed/docs/insights/v5/get-started) is the latest and provides both real-world data from the Chrome User Experience Report and lab data from Lighthouse.

This rules triggers when PageSpeed Insights detects that the size of one of your resources could
be reduced through minification.

### Overview

Minification refers to the process of removing unnecessary or redundant data without affecting how
the resource is processed by the browser - e.g. code comments and formatting, removing unused code,
using shorter variable and function names, and so on.

See [preprocessing \& context-specific optimizations](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/optimize-encoding-and-transfer#minification-preprocessing--context-specific-optimizations) to learn more.

### Recommendations

You should minify your HTML, CSS, and JavaScript resources:

- **To minify HTML,** try [HTMLMinifier](https://github.com/kangax/html-minifier)
- **To minify CSS,** try [CSSNano](https://github.com/ben-eb/cssnano) and [csso](https://github.com/css/csso).
- **To minify JavaScript,** try [UglifyJS](https://github.com/mishoo/UglifyJS2). The [Closure Compiler](https://developers.google.com/closure/compiler) is also [very effective](https://github.com/samccone/The-cost-of-transpiling-es2015-in-2016#summary-of-findings). You can create a build process that uses these tools to minify and rename the development files and save them to a production directory.

Alternatively, the [PageSpeed Module](https://developers.google.com/speed/pagespeed/module),
integrates with an Apache or Nginx web server to automatically optimize your site, including resource minification.

## Feedback

Was this page helpful?
<button class="button button-primary expand-control gc-analytics-event" data-category="Helpful" data-value="1" data-label="/speed/docs/insights/MinifyResources" style="background-color:#f44336;"> Yes </button>

> [!TIP]
> Great! Thank you for the feedback. If you have a specific, answerable question about using PageSpeed Insights, ask the question in English on [Stack
> Overflow](https://stackoverflow.com/questions/tagged/pagespeed-insights). For general questions, feedback, and discussion, start a thread in the [mailing list](https://groups.google.com/forum/#!forum/pagespeed-insights-discuss).

<button class="button button-primary expand-control gc-analytics-event" data-category="Helpful" data-value="0" data-label="/speed/docs/insights/MinifyResources" style="position:absolute;top:0;left:70px;background-color:#f44336;"> No </button>

> [!WARNING]
> Sorry to hear that. If you have a specific, answerable question about using PageSpeed Insights, ask the question in English on [Stack
> Overflow](https://stackoverflow.com/questions/tagged/pagespeed-insights). For general questions, feedback, and discussion, start a thread in the [mailing list](https://groups.google.com/forum/#!forum/pagespeed-insights-discuss).