Microsoft Ajax Minifier

One good thing I came across at the Microsoft MVP Summit is that Microsoft released Ajax Minifier, a tool to compress the size of Javascript (.JS) and Cascading Style Sheets (.CSS) files. Later I found a Scott Gu post on it.

The Microsoft Ajax Minifier is a small tool to remove unnecessary content from your js or css file. It can bring down the size of js file by 60%. You can download the Ajax Minifier from here.

After installing the tool, you will get a command prompt


and let’s say I have a js file with name “Validations.js” Let’s try minifying the file using this tool

A point to note here is:
Original Size: 7710 bytes; reduced size: 4918 bytes (36.2% minification)
Gzip of output approximately 1586 bytes (67.8% compression)

Currently the Ajax Minifier ships with two modes of

  1. Normal Crunching
  2. Hyper Crunching

With normal mode, it removes extra whitespace, all comments etc. When you use Hyper crunching mode it takes some more additional steps that includes shorting the name of local variables etc.

In order to use hyper crunching mode you need to add –hc switch in the command line. For instance:

ajaxmin validations.js –hc –o validations.min.js

So go ahead and try it out. Another great thing is that Ajax Minifier can be integrated with Visual Studio as well, which I will cover in the next post.