Minification is the process of removing unnecessary characters from code files, such as spaces, line breaks, comments and long variable names, without changing how the code works.
It is applied mainly to CSS, JavaScript and HTML. A minified file is harder for people to read but smaller to download and quicker for browsers to process.
Minification is usually combined with:
- Compression: Gzip or Brotli compression on the server, which shrinks files further during transfer.
- Removing unused code: often a bigger saving than minification itself.
- Deferring scripts: loading non-critical JavaScript after the main content.
How to apply it:
- WordPress caching and optimization plugins, such as LiteSpeed Cache, can minify automatically.
- Build tools in modern frameworks minify during deployment.
- CDNs can minify on the fly.
Things to watch:
- Minification occasionally breaks scripts, especially when combined with file merging. Test key features such as menus, forms and checkout after enabling it.
- The gain is usually modest. Removing heavy scripts, optimizing images and caching typically matter more for Page Speed.
Minification is part of our technical SEO speed work.
