Blog/Hacking Cookie Clicker
profile picture
Yash Singh
Hacking Cookie Clicker

Hacking Cookie Clicker

In this article I will share a little piece of code that took over Cookie Clicker from sugar lumps, to cookies, to upgrades. It does everything.

Cookie Clicker is an idle game that allows you to buy buildings and upgrades that will make cookies for you. You can also click on the large displayed cookie to get more. The buildings increase your CPS (Cookies per second) to speed up cookie production. The game adds in much more, such as sugar lumps, milk, and dragons that is there to explore.

There are multiple ways to hack cookie clicker that were made before. Most people, are unaware of Infinity being present in Javascript and run something like:

Game.Earn(
  999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
);

Cookie Clicker even offers its own DevTools with buttons to multiply and control the game. Another alternative to hacking would also be to do:

Game.RuinTheFun();

This is a function that just gives you lots and lots of cookies and CPS (Cookies Per Second). However, this spawns some Cookie Swallowers called wrinklers that have to be clicked to be removed. Of course it is possible to write a script that would remove them:

delete Game.wrinklers;

Some things that the Ruin The Fun hack has that mine doesn't is dragons and some squid. However, it doesn't increase your milk, CPS, and cookies to max. All three of the pieces of code combined could make a winning game.

Code

Straight up, here is the code:

Game.cookies = Infinity;
Game.lumps = Infinity;
 
function doEverything() {
  Game.ObjectsById.forEach((obj) => {
    obj.buy(10000);
    Game.cookies = Infinity;
  });
  document.querySelectorAll('#upgrades > div').forEach((div) => div.click());
  Game.cookiesPs = Infinity;
  Game.ObjectsById[0].levelUp();
  setTimeout(() => doEverything(), 1000);
}
 
doEverything();

First of all, it will earn Infinity cookies and sugar lumps, followed with a recursive function that will buy every item 10000 times, reearn the money, and then buy all the upgrades. Lastly, the level is leveled up using the sugar lumps. Using this code, it didn't take long to reach the highest milk level and finish the game with the Infinity cookie.

Save

If instead of writing in the code, you want the save code, here it is:

Mi4wMzF8fDE2MTkxMjgwOTk5OTY7MTYxOTEyODA5OTk5NjsxNjE5MTMwNTIzOTYxO0Nvb2wgU3BhY2VzaGlwO3NyeXFnfDExMTExMTAxMTAwMTAwMTAwMTAxMHxOYU47SW5maW5pdHk7MDsx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EyZSszMCwwLCwwLDQ4MDA7NDc5Miw0NzkyLDIuNDg1MDcyMzQ3ODkwMDY4ZSszMSwwLCwwLDQ3OTI7NDcwMCw0NzAwLDEuNjkzNzYzODA5Mzg1NDY0NmUrMzIsMCwsMCw0NzAwOzQ3MDAsNDcwMCwxLjIxNjIwMTI3NDQ3MjIyODJlKzMzLDAsLDAsNDcwMDt8MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEwMDAwMTExMTExMTExMTExMTExMTExMTExMTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDExMTExMTAwMDAwMDAwMDAxMTExMTEwMDExMDAwMDAwMDAwMDAwMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTExMTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMTExMTExMTExMTEwMDAwMDAwMDAwMDAxMTExMTEwMDAwMTExMTExMTExMTExMTExMTExMTEwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEwMDAwMDAxMTExMTExMTExMTExMTExMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMTExMTExMTExMTExMTExMTExMTAwMDAwMDAwMDAwMDExMTExMTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMTAwMDAxMTExMTExMTExMDAwMDAwMDAwMDAwMDAxMTExMTExMTExMTExMTExMTEwMDExMTEwMDExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTAwMTExMTExMTExMTAwMDAwMDAwMTExMTExMTExMTExMDAwMDAwMTEwMDExMTExMTExMTExMTAwMDAwMDAwMDAwMDAwMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMDAwMDExMTExMTExMTExMTExMTEwMDExMTExMTExMTExMTExMTExMTExMTExMTExMTEwMDExMTExMTExMTExMTExMTExMTExMTExMTAwMDAxMTExMDAxMTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEwMDAwMDAwMDExMTExMTExMTExMTExMTExMTExMTExMTAwMDAxMTExMTEwMDAwMDAxMTExMTExMTExMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMTExMTExMTExMTExMTExMTEwMDExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMDAwMDAwMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMDAwMDAwMDAxMTExMTExMTAwMDAxMTExfDExMTExMTExMTExMTExMTExMTExMTExMTExMDAwMTAwMDAxMTExMTAxMTExMTExMTExMTExMTExMTExMTExMTExMTExMDAxMDExMTEwMDEwMDEwMTAwMDExMTExMTExMTAwMDAwMTEwMDAwMDAwMDAwMDAxMTExMTExMTExMTExMTEwMTAxMTExMTExMTExMTEwMDExMTExMTExMTExMTAwMDAwMDAwMDAwMDExMTExMTExMTExMTExMTExMTEwMTExMDAwMDAwMDAwMDAwMDAxMTExMTExMTExMTExMTAxMTExMTExMTExMTExMTExMTExMTAwMDExMTAxMTExMTExMTExMTEwMDAwMDAwMDAwMDExMTExMTExMTExMTExMTExMTExMDAwMDAwMDAwMDAwMDAxMDAwMDAwMDAwMDAwMDAwMDAxMTExMTExMTEwMDAwMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEwMDAwMDExMTEwMDAwMDAwMDAwMDAwMDExMTExMTAwMTExMTExMTExMTExMTExMTExMTExMTExMTExMDAwMDEwMTAxMTExMTExMTExMTEwMDAwMDAxMTEwMDAwMDAwMDAwMDExMDAwMTExMDExMTExMTExMTExMTExMTExMDAxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEwMDAxMTExMTAwMDExMTB8fA%3D%3D%21END%21