Improve Core Web Vitals with Minification (2026)

Improve Core Web Vitals with Minification (2026)

Update for 2026: minify JavaScript and CSS to support LCP, INP and CLS. What minification does—and what it cannot fix alone.

07.11.2025
10 min read
Share this article:
Core Web VitalsSEOPerformanceMinificationOptimizationTutorial

Why Core Web Vitals matter for your site

Core Web Vitals are three metrics Google uses to measure how a page feels to visitors. LCP covers loading, INP responsiveness and CLS visual stability. They have been part of Google's page experience signals since 2021, alongside many other factors. Minifying JavaScript and CSS is one of the simplest ways to improve them, because smaller files download, parse and run sooner. This guide shows which metrics minification affects, which ones it barely touches, and how to check the result.

Core Web Vitals are part of Google's page experience signals
Smaller files download and parse sooner, which helps LCP and INP
Fewer visitors leave a page that loads and responds quickly
A smoother experience, especially on mobile
Less bandwidth used and lower transfer costs

What minification changes in Core Web Vitals

Metrics before and after, as an illustration

These figures illustrate the kind of gain possible. They are not a measurement. They describe an e-commerce site that minified its JavaScript and CSS. It also applied the other fixes in this guide, such as deferred scripts and critical CSS:

Core Web Vitals metrics comparison before and after optimization

Before optimization

LCP
4.2 s
INP
280 ms
CLS
0.25
Google Score
42/100
Bounce rate
68%
Conversion rate
2.1%

After optimization

LCP
2.1 s
INP
85 ms
CLS
0.08
Google Score
87/100
Bounce rate
38%
Conversion rate
4.2%

Improvements

LCP down by 50% (from 4.2 s to 2.1 s)
INP down by 70% (from 280 ms to 85 ms)
CLS divided by 3 (from 0.25 to 0.08)
Performance score more than doubled (from 42 to 87)
Conversion rate doubled (from 2.1% to 4.2%)
What it means for Google search

Google uses Core Web Vitals as one of its page experience signals, next to relevance and content quality. Good scores can help your pages in these ways:

SEO Benefits

A possible edge in search results when pages are otherwise comparable
A Core Web Vitals report in Google Search Console that lists the pages to fix
Field data from real visitors to guide your work
Pages that load and respond quickly keep more visitors
Wider reach on slow phones and connections

Monitoring your Core Web Vitals

Free measurement tools

Several free tools measure your Core Web Vitals:

Google PageSpeed Insights

Google's own tool for measuring Core Web Vitals

https://pagespeed.web.dev/
  • •Measures LCP, INP and CLS
  • •Performance score
  • •Recommendations for the tested page

Google Search Console

Core Web Vitals report for your site

https://search.google.com/search-console
  • •Data from real visitors
  • •Trends over time
  • •Pages that need work are listed

Chrome DevTools

Developer tools built into Chrome

  • •Integrated Lighthouse
  • •Live metrics while you browse
  • •Detailed performance profiling
Automating the checks

A script can run Lighthouse on a schedule or in your build, so a regression does not go unnoticed. A lab run reports Total Blocking Time (TBT) instead of INP, which needs real interactions:

Configuration GitHub Actions

// Example: a simple Lighthouse script (Node.js, ES module) import lighthouse from 'lighthouse'; import * as chromeLauncher from 'chrome-launcher'; async function checkCoreWebVitals(url) { const chrome = await chromeLauncher.launch({ chromeFlags: ['--headless'] }); const options = { port: chrome.port, onlyCategories: ['performance'] }; const runnerResult = await lighthouse(url, options); const audits = runnerResult.lhr.audits; console.log('LCP:', audits['largest-contentful-paint'].displayValue); console.log('TBT:', audits['total-blocking-time'].displayValue); console.log('CLS:', audits['cumulative-layout-shift'].displayValue); await chrome.kill(); } await checkCoreWebVitals('https://example.com');

Core Web Vitals in plain terms

LCP (Largest Contentful Paint) measures loading speed

LCP measures how long the largest visible element of your page (an image, a video or a block of text) takes to appear. Google rates an LCP of 2.5 seconds or less as good. Scripts and stylesheets that block rendering delay it. Smaller JavaScript and CSS files can shorten that wait.

LCP loading speed gauge showing optimized performance
Picture your site as a box you need to ship. Minification removes the packaging you do not need, so the box is lighter and arrives sooner. In the same way, a smaller file reaches the browser sooner, and the LCP can come earlier.
INP (Interaction to Next Paint) measures responsiveness

INP measures how long a page takes to show a response after a click, a tap or a key press, across the whole visit. It replaced First Input Delay (FID) as a Core Web Vital in March 2024. Google rates an INP of 200 milliseconds or less as good. Heavy JavaScript keeps the browser busy, so the response has to wait.

Think of INP as a car's reaction time. If the engine (JavaScript) is heavy and busy, it takes longer to respond. Minification trims the code the browser must download and parse. The time spent running your code only drops if you also ship less of it.
CLS (Cumulative Layout Shift) measures visual stability

CLS adds up unexpected movements of elements while a page loads, for example an image that suddenly pushes text down. Google rates a CLS of 0.1 or less as good. Minification has only a small effect here. Most shifts come from images without dimensions, web fonts and content inserted late.

CLS is like reading a book whose pages move while you read. Minified CSS arrives sooner, which helps when styles load late, but the main fixes are elsewhere.

Improving LCP with minification

How minification helps LCP

LCP depends on how soon the files that block rendering arrive, and JavaScript and CSS are among them. Before gzip, minification typically removes 30 to 70% of the bytes of a JavaScript file and 20 to 40% of a CSS file. They download sooner.

JavaScript minification: typically 30 to 70% smaller files
CSS minification: typically 20 to 40% smaller files
Critical resources arrive sooner
An earlier First Contentful Paint (FCP) when render-blocking files shrink
Less code for the browser to parse

Before

Original JavaScript file: 500 KB Loading time: 1.8 seconds LCP: 4.2 seconds

After

Minified JavaScript file: 150 KB Loading time: 0.6 seconds LCP: 2.1 seconds
Minification mostly saves download and parse time. These figures are an illustration, and yours will differ.
Practical ways to improve LCP

Concrete actions you can take:

Minify all your JavaScript and CSS files for production
Start with the resources that block rendering
Try your files in an online tool such as FastMinify to see the size saved
Build minification into your deployment process
Check your LCP regularly in Google PageSpeed Insights
FastMinify: a free tool that minifies JavaScript and CSS in your browser
Google PageSpeed Insights: measures your LCP with lab data and field data
Chrome DevTools: shows how your resources load
Lighthouse: audits performance and lists what to fix

Improving INP with JavaScript minification

Why minification can help INP

INP depends on how busy the browser's main thread is. While it parses and runs a large script, it cannot react to a click. The more JavaScript you ship, the more work it has to do.

When a visitor clicks a button while the browser is still running scripts, the response waits until the main thread is free. Minification shrinks what has to be downloaded and parsed. To cut execution time, ship less code as well, for instance by splitting large bundles.

Before

Unminified JavaScript: 800 KB Parsing time: 450 ms Average INP: 280 ms

After

Minified JavaScript: 250 KB Parsing time: 120 ms Average INP: 85 ms
In this illustrative example, INP drops by 70%
Practices that improve INP

Minification helps more when combined with other techniques:

Minify your JavaScript with a tool such as Terser, or with FastMinify
Avoid render-blocking JavaScript in the <head> of your page
Load non-critical scripts with async or defer
Run less JavaScript at initial load and split long tasks
Test your INP regularly in Chrome DevTools

Loading JavaScript without blocking the page

Before
<script src="app.js"></script> <!-- Blocking script, delays rendering -->
After
<script src="app.min.js" defer></script> <!-- Minified script loaded with defer -->
Minification plus defer gives a smaller file that no longer blocks the page.

Reducing CLS and the role of CSS minification

What CSS minification does for CLS

A layout shift happens when content moves after it first appears. A blocking stylesheet in the <head> is applied before the first paint, so it does not cause one. Shifts appear when styles arrive late, for example with a stylesheet loaded asynchronously or added by a script. A smaller file then applies sooner.

If your CSS is large and loaded without blocking rendering, the browser first shows unstyled content and restyles it once the file arrives. A smaller file shortens that gap. Minification does not remove the cause: reserve space for images, fonts and late content as well.

Before

CSS loaded without blocking: 400 KB Styles applied after: 0.9 seconds CLS: 0.25 (poor)

After

Minified CSS with critical CSS inlined: 280 KB Styles applied after: 0.6 seconds CLS: 0.08 (good)
In this illustrative example, CLS drops by 68% when minification is combined with the other fixes
Techniques to reduce CLS

These changes do most of the work:

Minify your CSS with CSSO or FastMinify
Extract the critical CSS (the part visible without scrolling) and inline it in the page
Set width and height on images and media
Limit font swaps that change the text size (FOUT/FOIT)
Reserve space for content that loads asynchronously

Inlining critical CSS

Before
<link rel="stylesheet" href="styles.css"> <!-- External stylesheet, applied once downloaded -->
After
<style> /* Minified critical CSS, inlined */ .header{background:#fff;padding:1rem} </style> <link rel="stylesheet" href="styles.min.css" media="print" onload="this.media='all'"> <!-- Non-critical CSS loaded asynchronously -->
This technique combines minification, inlined critical CSS and asynchronous loading. Visitors without JavaScript need a noscript fallback for the deferred stylesheet.

Compression and minification tools

Minification versus compression

Minification and compression complement each other. Minification removes whitespace and comments and shortens names. Compression with Gzip or Brotli then shrinks the minified file for transfer, and the browser decompresses it.

Minification takes the packaging off a parcel. Compression then packs the parcel tighter for the trip. Together they cut the bytes sent more than either one alone.
1
1. Write your JavaScript or CSS as usual
2
2. Minify the code (typically 30 to 70% smaller for JavaScript, 20 to 40% for CSS)
3
3. Compress the minified file with Gzip or Brotli on your server
4
4. Example: lodash.js goes from 546 KB to 71 KB with Terser, then to 25 KB with gzip level 9
Using FastMinify to minify your code

FastMinify is a free tool that minifies JavaScript and CSS in your browser. You install nothing.

Free for everyone, developers or not
Your code stays in your browser: nothing is sent to a server
Size statistics for each run
Options for the compression level, the ECMAScript version (ES5 to ES2022), class and function names, and the removal of console and debugger calls
Several JavaScript files can be combined and minified together

How to use

1
Open the JavaScript or CSS minification page on FastMinify
2
Paste your code in the editor
3
Choose your minification options
4
Select Minify to get the minified code
5
Copy or download the result
Try our JavaScript minification toolTry our CSS minification tool

Use them to see how minification changes the size of your own files.

Other tools

Besides FastMinify, other tools can minify your code:

Terser

Command-line tool to minify JavaScript

For developers who want to build minification into their workflow

CSSO

CSS optimizer that can restructure rules

For projects that need deeper CSS optimization

Webpack / Vite

Build tools with minification built in

For larger projects that manage assets automatically

Practical implementation guide

Minifying by hand, for beginners

If you are starting out or have a small site, you can minify your files by hand:

1. Prepare your files

Back up your original files before minifying them.

2. Use FastMinify

Open fastminify.com, choose the JavaScript or CSS tool, paste your code and minify it.

3. Download and replace

Download the minified file and use it in place of the original (keep the original for future edits).

4. Test

Test your site to check that everything works with the minified files.

Automating it, for developers

For larger projects, run minification in your build:

Webpack Configuration

// webpack.config.js const TerserPlugin = require('terser-webpack-plugin'); const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); module.exports = { optimization: { minimizer: [ new TerserPlugin(), new CssMinimizerPlugin() ] } };

package.json

{ "scripts": { "build": "webpack --mode=production" } }
In production mode, Webpack already minifies JavaScript with Terser. This configuration makes that explicit and adds CSS minification, which works on CSS extracted into its own files (for example with mini-css-extract-plugin).
Checking the results

After minifying, check how your Core Web Vitals change:

Checklist

Measure your LCP, INP and CLS with Google PageSpeed Insights
Compare file sizes before and after (JavaScript often 30 to 70% smaller, CSS 20 to 40%)
Test your site on different devices and connections
Follow the Core Web Vitals report in Google Search Console
Run your automated tests on the minified build

Common mistakes to avoid

Minifying without keeping the original

Always keep a copy of your original files. Minified files are hard to read and edit.

Keep in mind — Naming convention: “app.js” for the original, “app.min.js” for the minified version.

Minifying in development

Only minify for production. In development, keep your files readable so debugging stays easy.

Keep in mind — Use environment variables to tell development from production.

Skipping tests after minification

Minification can break code that depends on function names or on unsafe constructs. Test your site after every minified build.

Keep in mind — Automated tests catch these problems early. In FastMinify, the aggressive level enables unsafe optimizations, and console calls are removed by default.

Minifying already minified files

Minifying a file that is already minified brings almost no gain and adds risk.

Keep in mind — Check whether a file is already minified (one line, no extra whitespace, or a min suffix in its name) before minifying it.

Conclusion

Minifying JavaScript and CSS is one of the simplest optimizations for Core Web Vitals. It mostly helps LCP, because smaller files arrive sooner, and has a smaller effect on INP and CLS. The gain depends on your code and your setup, so measure before and after. Try a file in FastMinify, then check the result in Google PageSpeed Insights.

Minify your JavaScript, then measure your Core Web Vitals.

Minify your JavaScript and CSS files for production
Try a file in FastMinify to see the size saved
Regularly measure your Core Web Vitals with Google PageSpeed Insights
Build minification into your development workflow
Follow your metrics in Google Search Console
Remember that minification is a basic step: combine it with deferred scripts, critical CSS and images with set dimensions
Share this article
Share this article: