How to Unminify or Beautify JavaScript Code

So many websites use minified or obfuscated JavaScript code by removing all the unnecessary spaces and tabs. This makes the code very small which is easy to load. But at the same time, it also makes the code very hard to understand and very difficult to read. If you also have come across a piece of minified JavaScript code and want to understand it then the very first step would be to unminify that code.

In order to unminify or beautify a piece of JavaScript, CSS, HTML, XML and JSON code we can use an online app called Unminify. Here is how:

  1. First of all you have to visit Unminify at https://unminify.com/.
  2. Copy and paste your minified code in the text area on the Unminify website. You can also browse a file that contains the minified code. There is also an option to download the code from a URL.Unminify
  3. Change the tab size from 4 to anything you like or leave it to 4 if unsure, and then click on the Unminify button. The tab size is used for properly arranging the code structures such as functions, conditional statements or loops.
  4. It will take some time to unminify the code and make it pretty. Once you can see the beautified code, you can either copy it to the clipboard or download it in form of a file.Unminify

The same online tool Unminify can be used to unobfuscate, unpack or unminify codes of various kinds such as JavaScript, CSS, HTML, XML and JSON. It does not support beautification of server side scripts such as ASPX or PHP. If you attempt to paste any other type of code (other than the supported) then it will display error by turning the unrecognizable code red. It does the same of there is syntax based errors in your JavaScript or HTML code.