What is minification?

It is the application of several techniques which aim to reduce the overall byte size of your JavaScript and CSS files without compromising functionality. This includes safely renaming local variables to shorter names, stripping comments, and other techniques such as removing formatting and whitespace characters

Minified JavaScript and CSS files save bandwidth which improves the end-user experience and could even save you money on your bandwidth bills. It is also more difficult to reverse-engineer a file that has been minfied.

Written and hosted by Shishil Patel (@shishilpatel_).

Input CODE

Minified Output

What does it mean to compression / minify Javascript?

Minification (also called compression or obfuscation) is a technique used to optimize web sites load times by reducing the Javascript files sizes and combining multiple files into one.

This makes the javascript files download fast, reduces the bandwidth used and makes client browsers use fewer HTTP requests to render the web pages.

How does it work?

The small file size is accomplished by removing whitespace characters and comments that are not needed by web browsers. The code is also gently optimized where possible without breaking the behaviour. The file sizes are generally reduced between 30 - 90%. The last step is to combine the files into one file that hold all the Javascript for the requested web page.

Why should you do this?

The visitor will see the rendered page faster as the browser fetches the Javascript part of the page faster than if it was uncompressed. This is generally said to result in more happy and engaged web site visitors.

Disclaimer: While every effort is made to ensure that minification is safe, it is always wise to test all files thoroughly before using them in a production environment. This site and its owner are not liable for damages that result from using it. Use at your own risk.