Minification - Study24x7
Social learning Network


Updated on 31 May 2020
Web Camp
7 min read 15 views
Updated on 31 May 2020

First let’s understand what is minification.

Minification is the process of minimizing code. In simple words, Minification is the process to remove all unnecessary characters in javascript and css files to make them more compact. This includes the removal of whitespace, comments, new line characters etc.

Why minify?

When creating HTML, CSS and JavaScript files, developers tend to use spacing, comments and well-named variables to make code and markup readable for themselves. It also helps others who might later work on the assets. While this is a plus in the development phase, it becomes a negative when it comes to serving your pages. Web servers and browsers can parse file content without comments and well-structured code, both of which create additional network traffic without providing any functional benefit.

To minify JS, CSS and HTML files, comments and extra spaces need to be removed, as well as crunch variable names so as to minimize code and reduce file size. The minified file version provides the same functionality while reducing the bandwidth of network requests.



Minification vs compression:

Minification removes whitespace and other unnecessary characters from the file to create a different CSS file with exactly the same meaning.

but compressing uses a compression algorithm (such as gzip) and adds an HTTP response header to tell the client that the file is compressed CSS (instead of plain text CSS) so it can be decompressed before being passed to the CSS parser.


  1. When your webpage is loaded into the browser, it will be rendered quickly because less content is downloaded.
  2. Less data is transmitted over the network reduces bandwidth cost
  3. Faster loading improves UX and SEO
  4. File size is decreased by removing unnecessary content without compromising main functionality.

There are some online tools available, you can easily minify your code for any website. And for you WordPress users, there are some powerful plugins available to minify. Some of them are:

  3. and
  4. Dan’s Tools offers a CSS Minifier and a JavaScript Minifier.
  5. Refresh-SF
  6. Autoptimize (Wordpress)
  7. Fast Velocity Minify (Wordpress)
  8. W3 Total Cache (Wordpress)
  9. WP Super Cache (Wordpress)
  10. WP Fastest Cache (Wordpress)

Tips for minifying your files without breaking your site:

  1. Always backup your website before making changes
  2. When using tools such as PageSpeed Insights, be careful about implementing everything
  3. Don’t use multiple plugins to minify your files.
  4. Start with minifying for your CSS. If you’re using a plugin use its automatic mode first. If automatic mode doesn’t work, check the web browsers error console to confirm that the optimization isn’t working
  5. Once CSS is optimized, then try JavaScript minification. If you have errors with JavaScript, try the “combine only” option if the plugin has it. If it continues to generate errors, there could be bugs or an incompatibility with your theme or plugins that’s keeping your JavaScript from minifying.
  6. Also, if minification is done incorrectlt, it ccan mess up your site.

Thankyou for reading...

Please follow Web Camp for more such information.

Also, If you or your developer want me to develop something for you, you can contact me at :

Till then..#StaySafe #KeepLearning #KeepCoding

Write a comment...