Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Remove spaces and comments from JavaScript code (available in PHP and JavaScript)

branch: master
Octocat-spinner-32 tests Tests March 12, 2012
Octocat-spinner-32 jsShrink.js Link March 12, 2012
Octocat-spinner-32 jsShrink.php Support long regexps December 19, 2013
Octocat-spinner-32 readme.txt Link March 12, 2012
JsShrink - Remove spaces and comments from JavaScript code
Available in PHP and JavaScript
Requires statements ending by semicolon, use JSHint or JSLint to verify.

Usage PHP:
include "jsShrink.php";
echo jsShrink($code);

Usage JavaScript:
<script type="text/javascript" src="jsShrink.js"></script>
<script type="text/javascript">
textarea.value = jsShrink(code);

Google Closure Compiler is much more powerful and efficient tool.
JsShrink was created for those looking for PHP or JavaScript only solution.
Most other JS minifiers are not able to process valid JavaScript code:
Something went wrong with that request. Please try again.