Minification is the process of removing characters that code does not need to run, such as whitespace, line breaks and comments, and shortening variable names where safe. The result behaves identically but downloads faster. Modern build tools minify CSS and JavaScript automatically in production, so on most sites the work is checking that it is switched on.
Minification vs compression
Minification changes the file itself. Compression, such as gzip or Brotli, encodes the file for transfer and is reversed by the browser. They work together: minify at build time, then let the server or CDN compress the response. Both are standard Lighthouse checks.
/* Before */
.pricing-card {
padding: 24px; /* match design spec */
border-radius: 12px;
}
/* After */
.pricing-card{padding:24px;border-radius:12px}Where it is missed
Frameworks like Next.js, Vite and Astro minify production builds by default. Problems turn up in places outside the main build: hand-added scripts in a CMS, legacy plugins, inline scripts from marketing tools, or a site accidentally deployed in development mode.
Beyond minification
Minifying a large bundle helps less than shipping less code. Unused CSS and JavaScript, duplicate libraries and polyfills for browsers you no longer support often cost more than whitespace. Lighthouse's reduce unused JavaScript and CSS audits point to the bigger wins.
Example
A development build in production
After a hurried release, Brambleport's marketing site is deployed with a development build configuration. Lighthouse reports unminified JavaScript and much larger bundles than usual. Restoring the production build flag fixes it, and the team adds a CI check that fails if bundle size jumps unexpectedly.
Common mistakes
Shipping source maps publicly by accident
Source maps are useful for debugging but can expose source code. Decide deliberately whether to publish them.
Expecting minification to fix heavy pages
It trims bytes but does not reduce the amount of code that runs. Remove unused code too.
Questions
It can be, and some frameworks do it. The gain is usually small next to compression and to reducing CSS and JavaScript.