25

Possible Duplicate:
Online Tool to Unminify / Decompress JavaScript
Tool to reverse Javascript minify?

Is there a way to convert minified JavaScript code into normal?

Community
  • 1
  • 1
eomeroff
  • 9,599
  • 30
  • 97
  • 138

3 Answers3

33

http://jsbeautifier.org/ works like a charm.

Most software distributed under the GPL license will also provide non-minified code.

Rob W
  • 341,306
  • 83
  • 791
  • 678
  • It does not de-obfuscate names of variables. – Green Sep 04 '15 at 00:59
  • @Green how would it do that? You would have to give it a list of the original variable names and their obfuscated counterparts. – clayRay Jul 08 '16 at 06:09
  • 1
    @clayRay you are correct. Please check out source maps. https://www.html5rocks.com/en/tutorials/developertools/sourcemaps/ – Bob9630 Apr 19 '17 at 13:58
  • @Bob9630 thanks, very interesting! Has the idea been adopted more widely since the article was written in 2012? I've Googled it and it still seems largely a Mozilla thing. Someone has created a NuGet package for DotNet, but this still seems in prototype stage. – clayRay Apr 25 '17 at 02:01
  • 1
    @clayRay Source maps are supported by at least Firefox, Safari, Chrome (and Opera), IE/Edge. There are also plenty of tools available outside the browser (many on npm); from the top of my head I also know that there is a Python implementation, and I would not be surprised if there was an implementation in your favorite language. – Rob W Apr 25 '17 at 08:52
5

I use WebStorm by JetBrains for my Javascript IDE, it has auto-format which seems to do the trick pretty well.

Pwaddles
  • 142
  • 5
2

Chrome's native object inspector will format JS for you, but it won't be able to make sense of the variable names - nothing will.

If you want an online solution, use JSBeautifier. It works well, and is also very handy for making sense of some of the questions you see here on StackOverflow.

Bojangles
  • 99,427
  • 50
  • 170
  • 208
  • 'nothing will' I mean a human stepping through the code could. It might be nice to have a tool to "fill back in the values that a human knows" – Att Righ Jul 31 '22 at 13:24