Code minification (also called code minimization or code compression) is the process of removing all unnecessary characters from the source code. This includes removing all unwanted white space characters, new line characters, comments, etc. Code minification does not affect the functionality of the source code. It however, improves load time (and your web app’s performance) because the size of the file to be downloaded now reduces.

Here’s a list of five excellent JavaScript code minification tools that will make your scripts lighter and improve your code’s performance:

YUI Compressor

yui compressor

Developed by Yahoo!, YUI Compressor is a command-line tool written in Java that allows you to minify your JavaScript files. It is 100% safe and yields a higher compression ratio than most other tools. The YUI Compressor is also able to compress CSS files.

Google Closure Compiler


Google Closure Compiler is a tool for making JavaScript download and run faster. It is a true compiler for JavaScript. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what’s left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls.



JSMin removes comments and unnecessary whitespace from JavaScript files. It typically reduces file size by half, resulting in faster downloads. It also encourages a more expressive programming style because it eliminates the download cost of clean, literate self-documentation.



Packer by Dean Edwards is also a very popular JavaScript compressor, which automatically creates a compressed version of your code.  Just paste in the code and hit the ‘Pack’ button. It can go beyond regular compression and add advanced on-the-fly decompression with a JavaScript runtime piece.

Dojo ShrinkSafe

Dojo shrinksafe

ShrinkSafe is another compressor that parses the JavaScript using the rhino library and crunches local variable names. It can typically reduce the size of your scripts by a third or more, depending on your programming style. Best of all, ShrinkSafe will never change a public variable or API. This means that you can drop the compressed version of your JavaScript into your pages without changing the code that uses it.

Bonus tool (to find which minification tool works best for you):

Finding the right tool to compress your JavaScript code can be a bit tough as in many cases it depends on your application. To compare the different tools with your own JavaScript code without having to set up all the tools on your own, you can try the The JavaScript CompressorRater.

It shows aggregated statistics on the general level of compression in four of the tools covered above (namely JSMin, Dojo ShrinkSafe, YUI Compressor and Packer).

Which is your favorite minification tool? Add it in the comment section below.

Take your data visualization to a whole new level

From column to donut and radar to gantt, FusionCharts provides with over 100+ interactive charts & 2,000+ data-driven maps to make your dashboards and reports more insightful

Explore FusionCharts

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

4 responses on “5 Excellent JavaScript Minification Tools to Improve your Code’s Performance

  1. Thanks for the post. I think I will go for the dojo

  2. you can try this free online js minifier, it’s using Yui compressor tool.

  3. I am searching some tools to optimize javascript code of my web page. I found your post very helpful. Thanks for sharing such wonderful post.

  4. Here is another link please,, you can use it to Minify HTML/CSS/JS at one place.

Your next great dashboard starts here

With our interactive and responsive charts, extensive documentation, consistent API, and cross-browser support - delight your customers with kick-ass dashboards