Here’s how to minify your WordPress website files and make it load super faster

When working at the speed of a website, try to save milliseconds from every possible element.

This is why I recommend you to minify your WordPress site files.

Minify WordPress files allows you to eliminate unnecessary data.

So I recommend that you follow this guide to understand what it means and how to do it properly by rocketing your WordPress site .

Getting a fast and performing site is a complex activity made up of many practices.

First of all, you have to choose a hosting of excellent quality.

Then you will have to optimize your images , even using more advanced techniques such as lazy loading .

It will also be necessary to carefully choose the plugins you use and not to overdo the installations, always evaluating if the functionality you are looking for is not already available within the native WordPress functions.

We can therefore say that, to speed up WordPress , we must make sure to eliminate all the superfluous, and avoid unnecessary data being downloaded.

Let’s see what it is.

What it means to minify files

WordPress and plugins are written in various programming languages. There are PHP files, with HTML code inside them , then there are CSS files, and finally you also find JavaScript files for some functionality.

When a programmer develops code, he must necessarily keep his files in order in order to understand what function each part of the file performs and to avoid making mistakes that compromise its functioning.

For this reason, the files will be full of spaces, carriage returns, indents and comments.

All these elements are not necessary for the program to work properly. And here we can try to minifyWordPress files.

By eliminating spaces, comments, empty lines, the size of the files will be reduced, without compromising in any way the correct functioning of the plugin or function. This is usually a few kilobytes, but if your site contains a lot of files, you may notice some difference in performance.

Also, the browser will interpret the code faster, as it will no longer encounter strings which then have to be ignored.

File compression alone will certainly not make your site lightning fast but, used in conjunction with all other optimization practices, it will do its part.

Let’s take a CSS file for example. Here’s what it will look like as released by the developer.

If we apply minification, the result will be very different. As you can see, you will get a “wall” of code, much more difficult for humans to interpret, but much simpler for a machine.

According to a Google test , optimizing your files this way could save you as much as 63% of the file size, turning a 406-character code into just 150.

How do you minify a WordPress

Are you wondering if now you will have to go and delete all spaces and comments within the WordPress files? Don’t worry, you won’t have to do anything like this!

If you use a plugin like WP Rocket or W3 Total Cache , you will be able to take advantage of their features.

With WP Rocket, enter the File optimization section of the WP Rocket dashboard, you will find the items Minify HTML , Minify CSS files , Minify JavaScript files .

Make sure all three are active.

If you use W3 Total Cache instead, go to the Performance> Minify section . Check the Enable box in the HTML minify settings , JS minify settings , CSS minify settings items .

In the HTML section, you can also minify inline JS and CSS codes, i.e. those that appear directly within the HTML and not on external files.

For all three items, you can choose to delete line break removal as well .

If there are any files or pages that you prefer to keep with the extended code, specify their path.

Minify the codes manually

While this will probably never happen to you in your entire life, it may be complicated or impossible to minify files using such a plugin, for example, if they are part of other domains.

In this case, you could manually compress your files and upload them directly to the already optimized web space.

The HTML Compressor tool also allows you to directly upload the file and download it already optimized.


Working on the speed of your site, as you can see, concerns many aspects. I suggest you don’t miss a single one if you want to make sure your pages are really light.

Leave a Comment