JavaScript Minifier

Enter JavaScript Source code then click Minify button below to minify the JS code:

Free online tool to Minify JavaScript code.

JavaScript Minifier minifies the blocks of JavaScript content into valid JavaScript by removing all whitespace and comments. JavaScript Minifier online web tool will removing all unnecessary characters from source code, without changing its functionality and improve the performance

Sample JavaScript Code

// Demo code

                function StringStream(string) {
                  this.pos = 0;
                  this.string = string;
                };

                StringStream.prototype = {
                  done: function() {return this.pos >= this.string.length;},
                  peek: function() {return this.string.charAt(this.pos);},
                  next: function() {
                    if (this.pos < this.string.length)
                      return this.string.charAt(this.pos++);
                  },
                  eat: function(match) {
                    var ch = this.string.charAt(this.pos);
                    if (typeof match == "string") var ok = ch == match;
                    else var ok = ch && match.test ? match.test(ch) : match(ch);
                    if (ok) {this.pos++; return ch;}
                  }
                };
                

Sample Output Code

function StringStream(t){this.pos=0,this.string=t}StringStream.prototype={done:function(){return this.pos>=this.string.length},peek:function(){return this.string.charAt(this.pos)},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(t){var s=this.string.charAt(this.pos);if("string"==typeof t)var i=s==t;else var i=s&&t.test?t.test(s):t(s);return i?(this.pos++,s):void 0}};