Minification (in programming) is the process of compressing code from the original size to the smallest size, without affecting the operation of the code. It involves removing white-spaces, new lines, comments and modifying some unnecessary characters. Depending on the code, the process can reduce the original size anywhere from 5 to 90 percent.
We have gathered some automated tools that can help you reduce the size of your code without putting much effort. The final output will allow you to save some resources on the web server. We’ve split these tools according to the programming language. Have a look.
Majority of reduction is achieved by eliminating comments and extra white space. Whereas, joining consecutive var declaration, optimizing if statements and converting array to objects can save 10% of the size.
Overall, the listed tool will help you to reduce the number of HTTP requests, bandwidth consumption and provide quicker download time for your users.
JScompress is an online tool powered by Node.js and UglifyJS. Either copy/paste the code or upload the file for compression.
JSmini is Dan’s tool to compress your pretty well written JS code.
Koala is a GUI application for Sass, Less, JS minification, Compass, and CoffeeScript compilation. It supports Windows, Mac, and Linux.
CSS minification is a process of reducing CSS string/file size without altering the code functions. The process includes removing useless white spaces, line breaks, indentation characters, extra semi-colons, empty CSS declaration, unit with zero values, leading 0 (if float value is lower than 1) and stripping comments.
In order to achieve maximum reduction, RGB color values are converted to a shorter hexadecimal format, #BBCCDD are reduced to #BCD, none values are converted to 0 (where ever possible), and a few tools keep a single charset per CSS file eliminating all extra decelerations.
CSS Compressor allows you to minify CSS to make your website load faster. You can select from 4 levels of compression i.e. highest, high, standard and low.
CSS Minifier is simple, fast and quick web tool with an API.
Clean CSS is a well-tested node.js library for compressing CSS code.
CSSO has a usual compression technique and it can perform structural minimization of CSS files.
Coveloping is a web tool that gives you numerous manual options to compress the code. Either put a CSS file URL or paste the code.
CSSTidy is an open source CSS parser and optimizer, available as an executable file which can be controlled per command line and as PHP script.
Read: Hilarious Puns on CSS
Having compressed HTML files online could save you a lot of money on your server bills if you are hosting a very heavy bandwidth website. These compression tools will save space in HTML files by removing text line breaks, tab spaces, and replacing double spaces with single spaces without breaking the content structure.
HTMLcompressor is a small, fast and easy to use Java library that minifies HTML and XHTML code.
Text Fixer is on online compression tool that supports compression and decompression of HTML code.
Willpeavy allows you to minify HTML, XHTML and any JS or CSS included in your markup.
Kangax (beta) provides you numerous minify option while compressing your HTML code.
HTML minify is a node.js module that compresses HTML files with any JS and CSS.
Prepros is a cross-platform tool to compile Sass, Less, Compass, Jade, minify codes, automatic CSS prefixing and much more.
Microsoft Ajax Minifier allows you to improve the performance of the webpage by reducing the size of CSS and JS.
A NetBeans Plugin to minify CSS, HTML, and JS for quicker page load time.
Minifier is a simple command line tool for compressing CSS and JS without a big setup.
Ultraminifier is a free application for OS X which minifies JS and CSS with drag-drop.
Recommended: 10+ Best Programming Software | for writing code
Update – For those who are asking for PHP minifier
Yes, there are some tools available to compress PHP code, but they don’t do much except stripping spaces and comments.
Since PHP is compiled into bytecode (like Perl and Ruby) and then interpreted on top of Virtual Machine, there would be no significant advantage [in terms of speed] of compressing code. However, you can always use bytecode cache (such as APC) to increase performance.
Hope this helps!