JSFuck
JSFuck is an esoteric subset of JavaScript, where code is written using only six characters: [ , ] , ( , ) , ![src] , and + .[src] The name is derived from Brainfuck, an esoteric programming language that also uses a minimalistic alphabet of only punctuation.[src] Unlike Brainfuck, which requires its own compiler or interpreter, JSFuck is valid JavaScript code, meaning that JSFuck programs can be run in any web browser or engine that interprets JavaScript.[src] JSFuck is able to recreate all JavaScript functionality using such a limited set of characters because JavaScript allows the evaluation of any expression as any type.[src]
JSFuck is an esoteric subset of JavaScript, where code is written using only six characters: [ , ] , ( , ) , ![src] , and + .[src] The name is derived from Brainfuck, an esoteric programming language that also uses a minimalistic alphabet of only punctuation.[src] Unlike Brainfuck, which requires its own compiler or interpreter, JSFuck is valid JavaScript code, meaning that JSFuck programs can be run in any web browser or engine that interprets JavaScript.[src] JSFuck is able to recreate all JavaScript functionality using such a limited set of characters because JavaScript allows the evaluation of any expression as any type.[src] In July 2009, Yosuke Hasegawa created a web application called jjencode which could encode arbitrary JavaScript into an obfuscated form utilizing only the 18 symbols []()!+,\"$.:;_{}~= .[src] In January 2010, an informal competition was held in the "Obfuscation" forum of the sla.ckers.org web application security site to come up with a way to get the minimum number of characters required down to less than eight: []()!+,/ .[src] Contributors to the thread managed to eliminate the need for the , and / characters.[src] As of March 2010, an online encoder called JS-NoAlnum was available which utilized only the final set of six characters.[src] By the end of 2010, Hasegawa made a new encoder available named JSF*ck which also used only the minimum six characters.[src] In 2012, Martin Kleppe created a "jsfuck" project on GitHub, and a JSFuck.com website with a web app using that implementation of the encoder.[src] JSFuck can be used to bypass detection of malicious code submitted on websites, e.g.[src] in cross-site scripting (XSS) attacks.[src] Another potential use of JSFuck lies in code obfuscation.[src] An optimized version of JSFuck has been used to encode jQuery, a JavaScript library, into a fully functional version written with just the six characters.[src] The digits 2 to 9 are formed by summing true the appropriate number of times.[src] E.g.[src] in JavaScript true + true = 2 and true = !![] = !+[] , hence 2 can be written as !![]+!![] or !+[]+!+[] .[src] Other digits follow a similar pattern.[src] Integers consisting of two or more digits are written, as a string, by concatenating 1-digit arrays with the plus operator.[src] For example, the string "10" can be expressed in JavaScript as [1] + [0] .[src] By replacing the digits with the respective JSFuck expansions, this yields [+!+[ +[+[ .[src] To get a numeric value instead of a string, one would enclose the previous expression in parentheses or square brackets and prepend a plus, yielding 10 = +([+!+[ +[+[ ) .[src]
28 sentences · 28 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"JSFuck." encyclopegia.org, 2026, https://encyclopegia.org/wiki/jsfuck. Accessed 01 December 2026.
Chicago
"JSFuck." encyclopegia.org. Accessed December 1, 2026. https://encyclopegia.org/wiki/jsfuck.
APA
encyclopegia.org. (2026). JSFuck. Retrieved December 1, 2026, from https://encyclopegia.org/wiki/jsfuck
Accessed December 1, 2026 · CC BY-SA 4.0 · citation page · JSON