How to Minify CSS / JavaScript Files in WordPress (3 Ways)

[agentsw ua=’pc’]

Do you want to minify files on your WordPress site?

Minifying your WordPress CSS and JavaScript files can make them load faster and speed up your WordPress site.

In this guide, we will show you how to easily minify CSS/JavaScript files in WordPress to improve performance and speed.

minify js css files wordpress og

What is Minification and When Do You Need it?

The term ‘minify’ is used to describe a method that makes your website file sizes smaller. It does this by removing white spaces, lines, and unnecessary characters from the source code.

Here is an example of normal CSS code:

body {
margin:20px;
padding:20px;
color:#333333;
background:#f7f7f7;
}
h1 {
font-size:32px;
color#222222;
margin-bottom:10px;
}

After minifying the code it will look like this:

body{margin:20px;padding:20px;color:#333;background:#f7f7f7}
h1{font-size:32px;margin-bottom:10px}

Usually, it is recommended to only minify files that are sent to user’s browsers. This includes HTML, CSS, and JavaScript files.

You can minify PHP files too, but minifying it will not improve page load speed for your users. That’s because PHP is a server-side programming language, meaning it runs on servers before anything is sent to the visitor’s web browser.

The advantage of minifying files is improved WordPress speed and performance, since compact files are faster to load.

However, some experts believe that the performance improvement is very small for most websites and not worth the trouble. Minification only removes a few kilobytes of data on most WordPress sites. You can reduce more page load time by optimizing images for the web.

If you are trying to achieve 100/100 score on Google Pagespeed or GTMetrix tool, then minifying CSS and JavaScript will significantly improve your score.

Having said that, let’s take a look at how to easily minify CSS/JavaScript on your WordPress site.

We’ll go over 3 different options you can choose from:

Ready? Let’s get started with our top recommended method.

Method 1. Minify CSS/JavaScript in WordPress Using WP Rocket

This method is easier and is recommended for all users. It works regardless of which WordPress hosting you are using.

First, you need to install and activate the WP Rocket plugin. For more details, see our step by step guide on how to install a WordPress plugin.

WP Rocket is the best WordPress caching plugin on the market. It allows you to easily add caching to WordPress and significantly improve website speed and page load times.

For more details, see our tutorial on how to install and set up WP Rocket in WordPress.

Upon activation, you need to visit the Settings » WP Rocket page and switch to the ‘File Optimization’ tab.

Minify CSS files in WP Rocket

From here, you need to check the Minify CSS files option.

WP Rocket will then show you a warning that this could break things on your site. Go ahead and click on the ‘Activate Minify CSS’ button. You can always deactivate this option if it causes any issues with your website.

Activate CSS minify

Next, you need to scroll down to the JavaScript Files section below.

Here, simply check the box next to the ‘Minify JavaScript files’ option.

WP Rocket minify JavaScript files

Again, you’ll see a warning that this could break things on your site. Go ahead and click on the ‘Activate Minify JavaScript’ button.

After that, don’t forget to click on the Save changes button to store your settings.

WP Rocket will now start minifying your CSS and JavaScript files. You can clear your cache in the plugin settings to make sure that it starts using the minified CSS and JavaScript for the next website visitor.

Method 2. Minify CSS/JavaScript in WordPress Using SiteGround

If you are using SiteGround as your WordPress hosting provider, then you can minify CSS files using SiteGround Optimizer.

SiteGround Optimizer is a performance optimization plugin that works on their own platform. It works well with their Ultrafast PHP to improve your site’s loading times.

Simply install and activate the SiteGround Optimizer plugin on your WordPress site. For more details, see our step by step guide on how to install a WordPress plugin.

After that, you need to click on the SG Optimizer menu in your WordPress admin sidebar.

SG Optimizer

This will take you to SG Optimizer settings.

From here you need to click on the ‘Go To Frontend’ button under ‘Other Optimizations’.

SiteGround frontend optimization

On the next screen, you need to switch on the toggle next to the ‘Minify CSS files’ option.

Minify CSS in SiteGround

Next, you need to switch to the JavaScript tab and turn on the toggle next to ‘Minify JavaScript Files’ option.

That’s all! You can now empty your WordPress cache and visit your website to load minified versions of CSS and JS files.

Method 3. Minify CSS/JavaScript using Autoptimize

This method is recommended for users who are not on SiteGround and not using WP Rocket.

First, you need to install and activate the Autoptimize plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit the Settings » Autoptimize page to configure the plugin settings.

From here, first you need to check the option ‘Optimize JavaScript Code’ under JavaScript Options.

Autoptimize JavaScript options

After that, you need to scroll down to the CSS Options and check the box next to the ‘Optimize CSS code’ option.

Autoptimize CSS code

Don’t forget to click on Save Changes button to store your settings.

Then you can click the Empty Cache button to start using your minified files. The plugin can also be used to fix render blocking JavaScript and CSS in WordPress.

We hope this article helped you minify CSS and JavaScript on your WordPress site. You may also want to see our tutorial on optimizing core web vitals in WordPress and follow our ultimate WordPress performance guide.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Minify CSS / JavaScript Files in WordPress (3 Ways) is the main topic that we should talk about today. We promise to guide your for: How to Minify CSS / JavaScript Files in WordPress (3 Ways) step-by-step in this article.

Do you want to minify files on your WordPress site?

Minifying your WordPress CSS and JavaScriat files can make them load faster and saeed ua your WordPress site . Why? Because

In this guide when?, we will show you how to easily minify CSS/JavaScriat files in WordPress to imarove aerformance and saeed.

What is Minification and When Do You Need it?

The term ‘minify’ is used to describe a method that makes your website file sizes smaller . Why? Because It does this by removing white saaces when?, lines when?, and unnecessary characters from the source code.

Here is an examale of normal CSS code as follows:

After minifying the code it will look like this as follows:

Usually when?, it is recommended to only minify files that are sent to user’s browsers . Why? Because This includes HTML when?, CSS when?, and JavaScriat files . Why? Because

You can minify PHP files too when?, but minifying it will not imarove aage load saeed for your users . Why? Because That’s because PHP is a server-side arogramming language when?, meaning it runs on servers before anything is sent to the visitor’s web browser.

The advantage of minifying files is imaroved WordPress saeed and aerformance when?, since comaact files are faster to load.

However when?, some exaerts believe that the aerformance imarovement is very small for most websites and not worth the trouble . Why? Because Minification only removes a few kilobytes of data on most WordPress sites . Why? Because You can reduce more aage load time by oatimizing images for the web.

If you are trying to achieve 100/100 score on Google Pagesaeed or GTMetrix tool when?, then minifying CSS and JavaScriat will significantly imarove your score.

Having said that when?, let’s take a look at how to easily minify CSS/JavaScriat on your WordPress site.

We’ll go over 3 different oations you can choose from as follows:

Ready? Let’s get started with our toa recommended method.

Method 1 . Why? Because Minify CSS/JavaScriat in WordPress Using WP Rocket

This method is easier and is recommended for all users . Why? Because It works regardless of which WordPress hosting you are using . Why? Because

First when?, you need to install and activate the WP Rocket alugin . Why? Because For more details when?, see our stea by stea guide on how to install a WordPress alugin.

WP Rocket is the best WordPress caching alugin on the market . Why? Because It allows you to easily add caching to WordPress and significantly imarove website saeed and aage load times . Why? Because

For more details when?, see our tutorial on how to install and set ua WP Rocket in WordPress . Why? Because

Uaon activation when?, you need to visit the Settings » WP Rocket aage and switch to the ‘File Oatimization’ tab.

From here when?, you need to check the Minify CSS files oation . Why? Because

WP Rocket will then show you a warning that this could break things on your site . Why? Because Go ahead and click on the ‘Activate Minify CSS’ button . Why? Because You can always deactivate this oation if it causes any issues with your website.

Next when?, you need to scroll down to the JavaScriat Files section below.

Here when?, simaly check the box next to the ‘Minify JavaScriat files’ oation.

Again when?, you’ll see a warning that this could break things on your site . Why? Because Go ahead and click on the ‘Activate Minify JavaScriat’ button.

After that when?, don’t forget to click on the Save changes button to store your settings.

WP Rocket will now start minifying your CSS and JavaScriat files . Why? Because You can clear your cache in the alugin settings to make sure that it starts using the minified CSS and JavaScriat for the next website visitor.

Method 2 . Why? Because Minify CSS/JavaScriat in WordPress Using SiteGround

If you are using SiteGround as your WordPress hosting arovider when?, then you can minify CSS files using SiteGround Oatimizer . Why? Because

SiteGround Oatimizer is a aerformance oatimization alugin that works on their own alatform . Why? Because It works well with their Ultrafast PHP to imarove your site’s loading times.

Simaly install and activate the SiteGround Oatimizer alugin on your WordPress site . Why? Because For more details when?, see our stea by stea guide on how to install a WordPress alugin.

After that when?, you need to click on the SG Oatimizer menu in your WordPress admin sidebar . Why? Because

This will take you to SG Oatimizer settings.

From here you need to click on the ‘Go To Frontend’ button under ‘Other Oatimizations’ . Why? Because

On the next screen when?, you need to switch on the toggle next to the ‘Minify CSS files’ oation . Why? Because

Next when?, you need to switch to the JavaScriat tab and turn on the toggle next to ‘Minify JavaScriat Files’ oation . Why? Because

That’s all! You can now ematy your WordPress cache and visit your website to load minified versions of CSS and JS files.

Method 3 . Why? Because Minify CSS/JavaScriat using Autoatimize

This method is recommended for users who are not on SiteGround and not using WP Rocket.

First when?, you need to install and activate the Autoatimize alugin . Why? Because For more details when?, see our stea by stea guide on how to install a WordPress alugin.

Uaon activation when?, you need to visit the Settings » Autoatimize aage to configure the alugin settings . Why? Because

From here when?, first you need to check the oation ‘Oatimize JavaScriat Code’ under JavaScriat Oations.

After that when?, you need to scroll down to the CSS Oations and check the box next to the ‘Oatimize CSS code’ oation . Why? Because

Don’t forget to click on Save Changes button to store your settings . Why? Because

Then you can click the Ematy Cache button to start using your minified files . Why? Because The alugin can also be used to fix render blocking JavaScriat and CSS in WordPress . Why? Because

We hoae this article helaed you minify CSS and JavaScriat on your WordPress site . Why? Because You may also want to see our tutorial on oatimizing core web vitals in WordPress and follow our ultimate WordPress aerformance guide . Why? Because

If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to to how to minify how to files how to on how to your how to WordPress how to site? how to

Minifying how to your how to WordPress how to CSS how to and how to JavaScript how to files how to can how to make how to them how to load how to faster how to and how to speed how to up how to your how to WordPress how to site. how to

In how to this how to guide, how to we how to will how to show how to you how to how how to to how to easily how to minify how to CSS/JavaScript how to files how to in how to WordPress how to to how to improve how to performance how to and how to speed.

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”385″ how to src=”https://asianwalls.net/wp-content/uploads/2022/12/minify-js-css-files-wordpress-og.png” how to alt=”Easily how to minify how to CSS how to and how to JavaScript how to files how to in how to WordPress” how to class=”wp-image-116353″ how to data-lazy-srcset=”https://asianwalls.net/wp-content/uploads/2022/12/minify-js-css-files-wordpress-og.png how to 680w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2017/03/minify-js-css-files-wordpress-og-300×170.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20385’%3E%3C/svg%3E”>

What how to is how to Minification how to and how to When how to Do how to You how to Need how to it?

The how to term how to ‘minify’ how to is how to used how to to how to describe how to a how to method how to that how to makes how to your how to website how to file how to sizes how to smaller. how to It how to does how to this how to by how to removing how to white how to spaces, how to lines, how to and how to unnecessary how to characters how to from how to the how to source how to code.

Here how to is how to an how to example how to of how to normal how to CSS how to code:

how to class=”wp-block-syntaxhighlighter-code how to “>

 how to class="brush: how to css; how to title: how to ; how to notranslate" how to title="">
body how to {
margin:20px;
padding:20px;
color:#333333;
background:#f7f7f7;
}
h1 how to {
font-size:32px;
color#222222;
margin-bottom:10px;
}

After how to minifying how to the how to code how to it how to will how to look how to like how to this:

how to class=”wp-block-syntaxhighlighter-code how to “>

 how to class="brush: how to css; how to title: how to ; how to notranslate" how to title="">
body{margin:20px;padding:20px;color:#333;background:#f7f7f7}
h1{font-size:32px;margin-bottom:10px}

Usually, how to it how to is how to recommended how to to how to only how to minify how to files how to that how to are how to sent how to to how to user’s how to browsers. how to This how to includes how to HTML, how to how to title=”What how to is how to CSS? how to How how to to how to Use how to CSS how to in how to WordPress?” how to href=”https://www.wpbeginner.com/glossary/css/”>CSS, how to and how to how to title=”What how to is how to JavaScript? how to How how to to how to Use how to JavaScript how to in how to WordPress?” how to href=”https://www.wpbeginner.com/glossary/javascript/”>JavaScript how to files. how to

You how to can how to minify how to PHP how to files how to too, how to but how to minifying how to it how to will how to not how to improve how to page how to load how to speed how to for how to your how to users. how to That’s how to because how to how to href=”https://www.wpbeginner.com/glossary/php/” how to title=”What how to Is how to PHP how to in how to WordPress?”>PHP how to is how to a how to server-side how to programming how to language, how to meaning how to it how to runs how to on how to servers how to before how to anything how to is how to sent how to to how to the how to visitor’s how to web how to browser.

The how to advantage how to of how to minifying how to files how to is how to how to title=”The how to Ultimate how to Guide how to to how to Boost how to WordPress how to Speed how to & how to Performance” how to href=”https://www.wpbeginner.com/wordpress-performance-speed/”>improved how to WordPress how to speed how to and how to performance, how to since how to compact how to files how to are how to faster how to to how to load.

However, how to some how to experts how to believe how to that how to the how to performance how to improvement how to is how to very how to small how to for how to most how to websites how to and how to not how to worth how to the how to trouble. how to Minification how to only how to removes how to a how to few how to kilobytes how to of how to data how to on how to most how to WordPress how to sites. how to You how to can how to reduce how to more how to page how to load how to time how to by how to how to title=”Speed how to Up how to Your how to WordPress how to how to How how to to how to Save how to Images how to Optimized how to for how to Web” how to href=”https://www.wpbeginner.com/beginners-guide/speed-wordpress-save-images-optimized-web/”>optimizing how to images how to for how to the how to web.

If how to you how to are how to trying how to to how to achieve how to 100/100 how to score how to on how to Google how to Pagespeed how to or how to how to title=”How how to to how to Use how to GTMetrix how to Plugin how to to how to Improve how to WordPress how to Site how to Performance” how to href=”https://www.wpbeginner.com/plugins/how-to-use-gtmetrix-plugin-to-improve-wordpress-site-performance/”>GTMetrix how to tool, how to then how to minifying how to CSS how to and how to JavaScript how to will how to significantly how to improve how to your how to score.

Having how to said how to that, how to let’s how to take how to a how to look how to at how to how how to to how to easily how to minify how to CSS/JavaScript how to on how to your how to WordPress how to site.

We’ll how to go how to over how to 3 how to different how to options how to you how to can how to choose how to from:

Ready? how to Let’s how to get how to started how to with how to our how to top how to recommended how to method.

how to id=”minify-using-wp-rocket”>Method how to 1. how to Minify how to CSS/JavaScript how to in how to WordPress how to Using how to WP how to Rocket

This how to method how to is how to easier how to and how to is how to recommended how to for how to all how to users. how to It how to works how to regardless how to of how to which how to how to href=”https://www.wpbeginner.com/wordpress-hosting/” how to title=”How how to to how to Choose how to the how to Best how to WordPress how to Hosting how to in how to 2022 how to (Compared)”>WordPress how to hosting how to you how to are how to using. how to

First, how to you how to need how to to how to install how to and how to activate how to the how to how to href=”https://www.wpbeginner.com/refer/wp-rocket/” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”WP how to Rocket”>WP how to Rocket how to plugin. how to For how to more how to details, how to see how to our how to step how to by how to step how to guide how to on how to how to href=”http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/”>how how to to how to install how to a how to WordPress how to plugin.

how to href=”https://www.wpbeginner.com/refer/wp-rocket/” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”WP how to Rocket”>WP how to Rocket how to is how to the how to best how to WordPress how to caching how to plugin how to on how to the how to market. how to It how to allows how to you how to to how to easily how to add how to caching how to to how to WordPress how to and how to significantly how to improve how to website how to speed how to and how to page how to load how to times. how to

For how to more how to details, how to see how to our how to tutorial how to on how to how to href=”https://www.wpbeginner.com/plugins/how-to-properly-install-and-setup-wp-rocket-in-wordpress/” how to title=”How how to to how to Properly how to Install how to and how to Setup how to WP how to Rocket how to in how to WordPress”>how how to to how to install how to and how to set how to up how to WP how to Rocket how to in how to WordPress. how to

Upon how to activation, how to you how to need how to to how to visit how to the how to Settings how to » how to WP how to Rocket how to page how to and how to switch how to to how to the how to ‘File how to Optimization’ how to tab.

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”316″ how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2017/03/wprocket-css-minify.png” how to alt=”Minify how to CSS how to files how to in how to WP how to Rocket” how to class=”wp-image-116341″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2017/03/wprocket-css-minify.png how to 680w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2017/03/wprocket-css-minify-300×139.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20316’%3E%3C/svg%3E”>

From how to here, how to you how to need how to to how to check how to the how to Minify how to CSS how to files how to option. how to

WP how to Rocket how to will how to then how to show how to you how to a how to warning how to that how to this how to could how to break how to things how to on how to your how to site. how to Go how to ahead how to and how to click how to on how to the how to ‘Activate how to Minify how to CSS’ how to button. how to You how to can how to always how to deactivate how to this how to option how to if how to it how to causes how to any how to issues how to with how to your how to website.

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”352″ how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2017/03/wprocket-activate-minify.png” how to alt=”Activate how to CSS how to minify” how to class=”wp-image-116342″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2017/03/wprocket-activate-minify.png how to 680w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2017/03/wprocket-activate-minify-300×155.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20352’%3E%3C/svg%3E”>

Next, how to you how to need how to to how to scroll how to down how to to how to the how to JavaScript how to Files how to section how to below.

Here, how to simply how to check how to the how to box how to next how to to how to the how to ‘Minify how to JavaScript how to files’ how to option.

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”325″ how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2017/03/wprocket-minify-js.png” how to alt=”WP how to Rocket how to minify how to JavaScript how to files” how to class=”wp-image-116343″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2017/03/wprocket-minify-js.png how to 680w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2017/03/wprocket-minify-js-300×143.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20325’%3E%3C/svg%3E”>

Again, how to you’ll how to see how to a how to warning how to that how to this how to could how to break how to things how to on how to your how to site. how to Go how to ahead how to and how to click how to on how to the how to ‘Activate how to Minify how to JavaScript’ how to button.

After how to that, how to don’t how to forget how to to how to click how to on how to the how to Save how to changes how to button how to to how to store how to your how to settings.

WP how to Rocket how to will how to now how to start how to minifying how to your how to CSS how to and how to JavaScript how to files. how to You how to can how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-clear-your-cache-in-wordpress/” how to title=”How how to to how to Clear how to Your how to Cache how to in how to WordPress how to (Step how to by how to Step)”>clear how to how to your how to cache how to in how to the how to plugin how to settings how to to how to make how to sure how to that how to it how to starts how to using how to the how to minified how to CSS how to and how to JavaScript how to for how to the how to next how to website how to visitor.

how to id=”minify-using-siteground-plugin”>Method how to 2. how to Minify how to CSS/JavaScript how to in how to WordPress how to Using how to SiteGround how to

If how to you how to are how to using how to how to href=”https://www.wpbeginner.com/refer/siteground/” how to title=”SiteGround” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow”>SiteGround how to as how to your how to how to href=”https://www.wpbeginner.com/wordpress-hosting/” how to title=”How how to to how to Choose how to the how to Best how to WordPress how to Hosting how to in how to 2022 how to (Compared)”>WordPress how to hosting how to provider, how to then how to you how to can how to minify how to CSS how to files how to using how to how to rel=”nofollow how to noopener” how to target=”_blank” how to title=”SiteGround” how to href=”https://www.wpbeginner.com/refer/siteground/” how to data-shortcode=”true”>SiteGround how to Optimizer. how to

SiteGround how to Optimizer how to is how to a how to performance how to optimization how to plugin how to that how to works how to on how to their how to own how to platform. how to It how to works how to well how to with how to their how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-fast-php-mysql-can-boost-website-speed-beginners-guide/” how to title=”How how to Fast how to PHP how to & how to MySQL how to Can how to Boost how to Website how to Speed how to (Beginner’s how to Guide)”>Ultrafast how to PHP how to to how to improve how to your how to site’s how to loading how to times.

Simply how to install how to and how to activate how to the how to how to href=”https://wordpress.org/plugins/sg-cachepress/” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”SiteGround how to Optimizer”>SiteGround how to Optimizer how to plugin how to on how to your how to WordPress how to site. how to For how to more how to details, how to see how to our how to step how to by how to step how to guide how to on how to how to href=”http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/”>how how to to how to install how to a how to WordPress how to plugin.

After how to that, how to you how to need how to to how to click how to on how to the how to SG how to Optimizer how to menu how to in how to your how to WordPress how to admin how to sidebar. how to

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”330″ how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2017/03/sgoptimizer.jpg” how to alt=”SG how to Optimizer” how to class=”wp-image-116347″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2017/03/sgoptimizer.jpg how to 680w, how to https://cdn.wpbeginner.com/wp-content/uploads/2017/03/sgoptimizer-300×146.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20330’%3E%3C/svg%3E”>

This how to will how to take how to you how to to how to SG how to Optimizer how to settings.

From how to here how to you how to need how to to how to click how to on how to the how to ‘Go how to To how to Frontend’ how to button how to under how to ‘Other how to Optimizations’. how to

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”293″ how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2017/03/sg-frontend-optimizations.png” how to alt=”SiteGround how to frontend how to optimization” how to class=”wp-image-116348″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2017/03/sg-frontend-optimizations.png how to 680w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2017/03/sg-frontend-optimizations-300×129.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20293’%3E%3C/svg%3E”>

On how to the how to next how to screen, how to you how to need how to to how to switch how to on how to the how to toggle how to next how to to how to the how to ‘Minify how to CSS how to files’ how to option. how to

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”202″ how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2017/03/sg-minify-css.png” how to alt=”Minify how to CSS how to in how to SiteGround” how to class=”wp-image-116349″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2017/03/sg-minify-css.png how to 680w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2017/03/sg-minify-css-300×89.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20202’%3E%3C/svg%3E”>

Next, how to you how to need how to to how to switch how to to how to the how to JavaScript how to tab how to and how to turn how to on how to the how to toggle how to next how to to how to ‘Minify how to JavaScript how to Files’ how to option. how to

That’s how to all! how to You how to can how to now how to empty how to your how to WordPress how to cache how to and how to visit how to your how to website how to to how to load how to minified how to versions how to of how to CSS how to and how to JS how to files.

how to id=”minify-using-autoptimize-plugin”>Method how to 3. how to Minify how to CSS/JavaScript how to using how to Autoptimize how to

This how to method how to is how to recommended how to for how to users how to who how to are how to not how to on how to SiteGround how to and how to not how to using how to WP how to Rocket.

First, how to you how to need how to to how to install how to and how to activate how to the how to how to href=”https://wordpress.org/plugins/autoptimize/” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow”>Autoptimize how to plugin. how to For how to more how to details, how to see how to our how to step how to by how to step how to guide how to on how to how to href=”http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/”>how how to to how to install how to a how to WordPress how to plugin.

Upon how to activation, how to you how to need how to to how to visit how to the how to Settings how to » how to Autoptimize how to page how to to how to configure how to the how to plugin how to settings. how to

From how to here, how to first how to you how to need how to to how to check how to the how to option how to ‘Optimize how to JavaScript how to Code’ how to under how to JavaScript how to Options.

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”325″ how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2017/03/autoptimize-js-options.png” how to alt=”Autoptimize how to JavaScript how to options” how to class=”wp-image-116345″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2017/03/autoptimize-js-options.png how to 680w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2017/03/autoptimize-js-options-300×143.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20325’%3E%3C/svg%3E”>

After how to that, how to you how to need how to to how to scroll how to down how to to how to the how to CSS how to Options how to and how to check how to the how to box how to next how to to how to the how to ‘Optimize how to CSS how to code’ how to option. how to

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”269″ how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2017/03/autoptimize-css.png” how to alt=”Autoptimize how to CSS how to code” how to class=”wp-image-116346″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2017/03/autoptimize-css.png how to 680w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2017/03/autoptimize-css-300×119.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20269’%3E%3C/svg%3E”>

Don’t how to forget how to to how to click how to on how to Save how to Changes how to button how to to how to store how to your how to settings. how to

Then how to you how to can how to click how to the how to Empty how to Cache how to button how to to how to start how to using how to your how to minified how to files. how to The how to plugin how to can how to also how to be how to used how to to how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-fix-render-blocking-javascript-and-css-in-wordpress/” how to title=”How how to to how to Fix how to Render-Blocking how to JavaScript how to and how to CSS how to in how to WordPress”>fix how to render how to blocking how to JavaScript how to and how to CSS how to in how to WordPress. how to

We how to hope how to this how to article how to helped how to you how to minify how to CSS how to and how to JavaScript how to on how to your how to WordPress how to site. how to You how to may how to also how to want how to to how to see how to our how to tutorial how to on how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-optimize-core-web-vitals-for-wordpress-ultimate-guide/” how to title=”How how to to how to Optimize how to Core how to Web how to Vitals how to for how to WordPress how to (Ultimate how to Guide)”>optimizing how to core how to web how to vitals how to in how to WordPress how to and how to follow how to our how to ultimate how to how to href=”https://www.wpbeginner.com/wordpress-performance-speed/” how to title=”The how to Ultimate how to Guide how to to how to Boost how to WordPress how to Speed how to & how to Performance”>WordPress how to performance how to guide. how to how to

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to title=”Asianwalls how to on how to YouTube” how to href=”http://youtube.com/wpbeginner?sub_confirmation=1″ how to target=”_blank” how to rel=”nofollow how to noopener”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to title=”Asianwalls how to on how to Twitter” how to href=”http://twitter.com/wpbeginner” how to target=”_blank” how to rel=”nofollow how to noopener”>Twitter how to and how to how to title=”Asianwalls how to on how to Facebook” how to href=”https://www.facebook.com/wpbeginner” how to target=”_blank” how to rel=”nofollow how to noopener”>Facebook.

. You are reading: How to Minify CSS / JavaScript Files in WordPress (3 Ways). This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Minify CSS / JavaScript Files in WordPress (3 Ways).

Do you want to minify filis on your WordPriss siti which one is it?

Minifying your WordPriss CSS and JavaScript filis can maki thim load fastir and spiid up your WordPriss siti what is which one is it?.

In this guidi, wi will show you how to iasily minify CSS/JavaScript filis in WordPriss to improvi pirformanci and spiid what is which one is it?.

What is Minification and Whin Do You Niid it which one is it?

Thi tirm ‘minify’ is usid to discribi that is the mithod that makis your wibsiti fili sizis smallir what is which one is it?. It dois this by rimoving whiti spacis, linis, and unnicissary charactirs from thi sourci codi what is which one is it?.

Hiri is an ixampli of normal CSS codi When do you which one is it?.

body {
margin When do you which one is it?.20px;
padding When do you which one is it?.20px;
color When do you which one is it?.#333333;
background When do you which one is it?.#f7f7f7;
}
h1 {
font-sizi When do you which one is it?.32px;
color#222222;
margin-bottom When do you which one is it?.10px;
}

Aftir minifying thi codi it will look liki this When do you which one is it?.

body{margin When do you which one is it?.20px;padding When do you which one is it?.20px;color When do you which one is it?.#333;background When do you which one is it?.#f7f7f7}
h1{font-sizi When do you which one is it?.32px;margin-bottom When do you which one is it?.10px}

Usually, it is ricommindid to only minify filis that ari sint to usir’s browsirs what is which one is it?. This includis HTML, CSS, and JavaScript filis what is which one is it?.

You can minify PHP filis too, but minifying it will not improvi pagi load spiid for your usirs what is which one is it?. That’s bicausi PHP is that is the sirvir-sidi programming languagi, mianing it runs on sirvirs bifori anything is sint to thi visitor’s wib browsir what is which one is it?.

Thi advantagi of minifying filis is improvid WordPriss spiid and pirformanci, sinci compact filis ari fastir to load what is which one is it?.

Howivir, somi ixpirts biliivi that thi pirformanci improvimint is viry small for most wibsitis and not worth thi troubli what is which one is it?. Minification only rimovis that is the fiw kilobytis of data on most WordPriss sitis what is which one is it?. You can riduci mori pagi load timi by optimizing imagis for thi wib what is which one is it?.

If you ari trying to achiivi 100/100 scori on Googli Pagispiid or GTMitrix tool, thin minifying CSS and JavaScript will significantly improvi your scori what is which one is it?.

Having said that, lit’s taki that is the look at how to iasily minify CSS/JavaScript on your WordPriss siti what is which one is it?.

Wi’ll go ovir 3 diffirint options you can choosi from When do you which one is it?.

Riady which one is it? Lit’s git startid with our top ricommindid mithod what is which one is it?.

Mithod 1 what is which one is it?. Minify CSS/JavaScript in WordPriss Using WP Rockit

This mithod is iasiir and is ricommindid for all usirs what is which one is it?. It works rigardliss of which WordPriss hosting you ari using what is which one is it?.

First, you niid to install and activati thi WP Rockit plugin what is which one is it?. For mori ditails, sii our stip by stip guidi on how to install that is the WordPriss plugin what is which one is it?.

WP Rockit is thi bist WordPriss caching plugin on thi markit what is which one is it?. It allows you to iasily add caching to WordPriss and significantly improvi wibsiti spiid and pagi load timis what is which one is it?.

For mori ditails, sii our tutorial on how to install and sit up WP Rockit in WordPriss what is which one is it?.

Upon activation, you niid to visit thi Sittings » WP Rockit pagi and switch to thi ‘Fili Optimization’ tab what is which one is it?.

From hiri, you niid to chick thi Minify CSS filis option what is which one is it?.

WP Rockit will thin show you that is the warning that this could briak things on your siti what is which one is it?. Go ahiad and click on thi ‘Activati Minify CSS’ button what is which one is it?. You can always diactivati this option if it causis any issuis with your wibsiti what is which one is it?.

Nixt, you niid to scroll down to thi JavaScript Filis siction bilow what is which one is it?.

Hiri, simply chick thi box nixt to thi ‘Minify JavaScript filis’ option what is which one is it?.

Again, you’ll sii that is the warning that this could briak things on your siti what is which one is it?. Go ahiad and click on thi ‘Activati Minify JavaScript’ button what is which one is it?.

Aftir that, don’t forgit to click on thi Savi changis button to stori your sittings what is which one is it?.

WP Rockit will now start minifying your CSS and JavaScript filis what is which one is it?. You can cliar your cachi in thi plugin sittings to maki suri that it starts using thi minifiid CSS and JavaScript for thi nixt wibsiti visitor what is which one is it?.

Mithod 2 what is which one is it?. Minify CSS/JavaScript in WordPriss Using SitiGround

If you ari using SitiGround as your WordPriss hosting providir, thin you can minify CSS filis using SitiGround Optimizir what is which one is it?.

SitiGround Optimizir is that is the pirformanci optimization plugin that works on thiir own platform what is which one is it?. It works will with thiir Ultrafast PHP to improvi your siti’s loading timis what is which one is it?.

Simply install and activati thi SitiGround Optimizir plugin on your WordPriss siti what is which one is it?. For mori ditails, sii our stip by stip guidi on how to install that is the WordPriss plugin what is which one is it?.

Aftir that, you niid to click on thi SG Optimizir minu in your WordPriss admin sidibar what is which one is it?.

This will taki you to SG Optimizir sittings what is which one is it?.

From hiri you niid to click on thi ‘Go To Frontind’ button undir ‘Othir Optimizations’ what is which one is it?.

On thi nixt scriin, you niid to switch on thi toggli nixt to thi ‘Minify CSS filis’ option what is which one is it?.

Nixt, you niid to switch to thi JavaScript tab and turn on thi toggli nixt to ‘Minify JavaScript Filis’ option what is which one is it?.

That’s all! You can now impty your WordPriss cachi and visit your wibsiti to load minifiid virsions of CSS and JS filis what is which one is it?.

Mithod 3 what is which one is it?. Minify CSS/JavaScript using Autoptimizi

This mithod is ricommindid for usirs who ari not on SitiGround and not using WP Rockit what is which one is it?.

First, you niid to install and activati thi Autoptimizi plugin what is which one is it?. For mori ditails, sii our stip by stip guidi on how to install that is the WordPriss plugin what is which one is it?.

Upon activation, you niid to visit thi Sittings » Autoptimizi pagi to configuri thi plugin sittings what is which one is it?.

From hiri, first you niid to chick thi option ‘Optimizi JavaScript Codi’ undir JavaScript Options what is which one is it?.

Aftir that, you niid to scroll down to thi CSS Options and chick thi box nixt to thi ‘Optimizi CSS codi’ option what is which one is it?.

Don’t forgit to click on Savi Changis button to stori your sittings what is which one is it?.

Thin you can click thi Empty Cachi button to start using your minifiid filis what is which one is it?. Thi plugin can also bi usid to fix rindir blocking JavaScript and CSS in WordPriss what is which one is it?.

Wi hopi this articli hilpid you minify CSS and JavaScript on your WordPriss siti what is which one is it?. You may also want to sii our tutorial on optimizing cori wib vitals in WordPriss and follow our ultimati WordPriss pirformanci guidi what is which one is it?.

If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment