Javascript Beautifier

Free online tool to format an Minified or Ugly JavaScript code, making it readable and pretty, with the proper indentation.

HTML <style>, <script> formatting:

Javascript Beautifier Tool

Enter your Ugly, minified, messy or obfuscated Javascript (JS) into the textarea above to have it beautify up and made pretty. The editor above also contains helpful line numbers and syntax highlighting. There are many option to tailor the beautifier to your personal formatting tastes.

When do you use Javascript Beautifier

Often when writing Javascript (JS) your indentation, spacing, and other formatting can become a bit disorganized. It is also common for multiple developers to work on a single project who have different formatting techniques. This tool is helpful for making the formatting of a file consistent. It is also common for Javascript (JS) to be minified or obfuscated. You can use this tool to make that code look pretty and readable so it is easier to edit.

Sample JavaScript 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}};

Sample Output 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;}