Skip to content

Unminify

Bundlers and obfuscators commonly minify code (remove new lines and whitespace, replace variable names with shorter ones, use a shorter syntax).

Most unminify sites just format the code, but webcrack also converts the syntax back to make it more readable and similar to the original code:

block-statement

js
if (a) b(); 
if (a) { 
  b();  
} 

computed-properties

js
console["log"](a); 
console.log(a); 

for-to-while

js
for (;;) a(); 
while (true) a(); 
js
for (; a < b;) c(); 
while (a < b) c(); 

infinity

js
1 / 0
Infinity

invert-boolean-logic

js
!(a == b) 
a != b 
js
!(a || b || c) 
!a && !b && !c 
js
!(a && b && c) 
!a || !b || !c 

json-parse

js
JSON.parse("[1,2,3]") 
[1, 2, 3] 

logical-to-if

js
x && y && z(); 
if (x && y) { 
  z(); 
} 
js
x || y || z(); 
if (!(x || y)) { 
  z(); 
} 

merge-else-if

js
if (x) {
} else {  
  if (y) {}  
}  

if (x) {
} else if (y) {} 

merge-strings

js
"a" + "b" + "c"
"abc"

number-expressions

js
-0x1021e + -0x7eac8 + 0x17 * 0xac9c
431390

raw-literals

js
'\x61"\u270F\uFE0F\t'
"a\"✏️\t"
js
0x1
1

remove-double-not

js
if (!!a) b(); 
if (a) b(); 
js
!!a ? b() : c(); 
a ? b() : c(); 
js
return !!!a; 
return !a; 
js
[].filter(a => !!a); 
[].filter(a => a); 

sequence

js
if (a) b(), c(); 
if (a) { 
  b(); 
  c(); 
} 
js
if (a(), b()) c(); 
a(); 
if (b()) { 
  c(); 
} 
js
return a(), b(), c(); 
a(); 
b(); 
return c(); 
js
for (let key in a = 1, object) {} 
a = 1; 
for (let key in object) {} 
js
for (let value of (a = 1, array)) {} 
a = 1; 
for (let value of array) {} 
js
for((a(), b());;) {} 
a(); 
b(); 
for(;;) {} 
js
for(; i < 10; a(), b(), i++) {} 
for(; i < 10; i++) { 
  a(); 
  b(); 
} 
js
a = (b = null, c); 
b = null; 
a = c; 

split-for-loops-vars

Minifiers commonly inline variables into for loops. Example: esbuild

To improve readability we only move the variables outside that are not used in the loop's test or update expressions.

js
for (var j = 0, i = 0; i < 3; i++) {} 
var j = 0; 
for (var i = 0; i < 3; i++) {} 

split-variable-declarations

js
const a = 1, b = 2, c = 3; 
const a = 1; 
const b = 2; 
const c = 3; 

ternary-to-if

js
a ? b() : c(); 
if (a) { 
  b(); 
} else { 
  c(); 
} 
js
return a ? b() : c(); 
if (a) { 
  return b(); 
} else { 
  return c(); 
} 

typeof-undefined

js
typeof a > "u"
typeof a === "undefined"
js
typeof a < "u"
typeof a !== "undefined"

unminify-booleans

js
!0
true
js
!1
false

void-to-undefined

js
void 0
undefined

yoda

https://eslint.org/docs/latest/rules/yoda and https://babeljs.io/docs/en/babel-plugin-minify-flip-comparisons

js
"red" === color 
color === "red"