Facts
Released
2013-08-08 (web)
Genre
Clicker, Idle
Platforms
web, Windows, Android
Developer
Orteil, Opti
Code
Game script by Orteil and Opti
Game script, Cookie Clicker, 13 Aug 2013 capture
Game script, Cookie Clicker main.js v1.035
Evidence
Verified (11)
Developer (6)
Code (5)
Sources
5
On this page
  1. Prices
  2. History of the price rule
  3. Related
  4. Mechanics
  5. References
  6. Sources

Cookie Clicker is a web incremental game by Orteil and Opti1. You click a cookie, then buy buildings that bake for you. It launched on 8 August 20132, reached Android in 20193 and Steam in 20214. Its web code is one unminified main.js, archived from the first weeks.

#Prices

Prices scale exponentially: each building owned multiplies the next of its kind by 1.155, one constant for all 20 buildings. Free buildings from prestige upgrades come off the exponent6. Discounts multiply in before the rounding7.

Only the Cursor keeps the 15 written into its definition; a formula on the index overwrites the rest8,9. It gives Grandma 100, Farm 1,100, Mine 12,000, and so on10. A sibling formula sets base production11, and a type’s output is its count times that rate12.

RuleWhereEvidence
×1.15 per one ownedmain.js L79725
⌈base⋅1.15owned−free⌉main.js L8090–L809513
Buy 10 / 100 = geometric sum, rounded oncemain.js L8096–L810514
Purchase loops one at a time, each roundedmain.js L8125–L815215
Sell pays 25% of the next pricemain.js L8156–L817616

Ten Grandmas from zero show 2,031 but cost 2,035, and one cookie short of the label still buys nine15. The sell label is 25% of the last building’s price, so the refund is about 15% more16.

#History of the price rule

The earliest capture, 13 August 2013, sets each new price to ⌈price×1.1⌉17,18. By v1.035, captured 10 September 2013, the rule was base×1.15n19. The changelog’s 24 August “big update!” falls between the two20. The 2014 legacy beta lists “price and CpS curves revamped”21.

Mechanics

MechanicKindHow
Exponential cost scalingFixed ratio×1.15 per building owned, one constant for all buildings
Bulk buyingOne at a timebuy 1, 10, or 100; the label is the geometric sum rounded once, and the purchase rounds each building
PrestigeCurrencythe prestige level is the cube root of cookies baked over 10¹², each level a heavenly chip
Every claim about this game, by concept (26)
generalThe changelog dates the launch to 8 August 2013; Orteil says he made the original “in a couple hours, for laughs”.Developer
The game's About text credits it as “a javascript game by Orteil and Opti”.Developer
The changelog's 1 September 2021 entry announces the Steam release and says web and Steam will get the same updates.Developer
The changelog's 28 September 2019 entry announces the official Android version, with iOS to follow.Developer
Bulk buyingThe shown bulk price is the geometric sum b⋅ra⋅(rk−1)/(r−1), discounted and rounded up once: 20.30× the next single price for 10, and 7.83 million× for 100.Verified
Bulk options are 1, 10, and 100; “All” works only in sell mode and means 100 in buy mode.Code
buy() charges each unit's rounded-up price in turn and ignores the shown total: 10 Grandmas from zero cost 2,035, not 2,031, and 2,030 cookies still buy 9.Verified
Exponential cost scalingOne global constant, 1.15, multiplies a building's price for each one already owned.Verified
A building's next price is ⌈base×1.15max⁡(0,owned−free)⌉, with discounts applied before rounding.Verified
Free buildings (Starter kit: 10 Cursors; Starter kitchen: 5 Grandmas) come off the exponent, so the next one costs the base price.Verified
Every building after the Cursor gets its base price from one formula on its index n: (n+9+5max⁡(0,n−5)1.75)×10n×max⁡(1,n−14), rounded to two significant figures, then ×10 at id 16, ×100 at 17, ×1,000 at 18, and ×20,000 at 19.Verified
Only the Cursor keeps its Game.Object constructor price; the formula overwrites the rest (the Farm's 500 becomes 1,100).Verified
Base prices (the first one's price) are Cursor 15, Grandma 100, Farm 1,100, Mine 12,000, Factory 130,000, Bank 1.4 million, and so on up to You at 5.4 × 10²⁶.Verified
Base production before upgrades is 0.1 cookies/s for the Cursor, set in its own production function, and ⌈10⋅nn/2+2⌉/10 to two significant figures for building n: Grandma 1, Farm 8, Mine 47, Factory 260, and so on up to You at 5.1 × 10¹⁴.Verified
Each type's production is its count times its stored rate per building, summed into cookies per second, so before upgrades income grows linearly with count.Code
On Grandma income alone, the wait for the next Grandma is 115 s for the 2nd, a low of 38 s for the 8th, and 36 minutes for the 51st.Verified
Each sale pays 25% of the next one's price, rounded down, about 15% more than the label: selling 1 of 10 Grandmas shows 88 and pays 101.Verified
Upgrades, auras, buffs, and gods multiply the price by factors that don't depend on the count, most of them discounts such as 0.99 or 0.95 and one a rise (the Nasty goblins buff, 1.02), so they scale the curve without changing its 1.15 slope.Code
The original (13 August 2013 capture) set each new price to ⌈price×1.1⌉, compounding the rounding: the 51st Cursor cost 2,283, not the unrounded 1,761.Verified
The original version's starting prices were Cursor 15, Grandma 100, Factory 500, Mine 2,000, Shipment 7,000, Alchemy lab 50,000, and Portal 1,000,000.Code
By v1.035 (captured 10 September 2013), the price was base×1.15amount via the same global constant, still unrounded.Code
In v1.035, the building constructor sets each building's base price to the literal its definition passes, such as the Farm's 500.Code
The changelog's 24 August 2013 “big update!”, which “revamped the whole game (new graphics, new game mechanics)”, falls between two Wayback captures, the original version of 13 August 2013 and v1.035 of 10 September 2013.Developer
The 25 August 2014 “legacy beta, part I” notes say “price and CpS curves revamped”.Developer
PrestigeIn Cookie Clicker (web 2.058), ascending sets the prestige level to ⌊C/10123⌋ for C cookies baked across all ascensions, and each new level adds one heavenly chip.Code
In Cookie Clicker, each prestige level adds 1% to production times a heavenly multiplier that starts at 0; five heavenly upgrades add up to 1 (0.05, 0.20, then 0.25 three times), and the rest of the routine scales it by the Dragon God aura, three Lucky upgrades (×1.01 each), and a god's slot (×0.7, ×0.8, or ×0.9).Code

References

  1. ^DeveloperCookie Clicker main.js v2.058
    How we know

    The game's About text credits it as “a javascript game by Orteil and Opti”.

    Cookie Clicker is a javascript game by %1 and %2.
    main.js#L1410 · archived copy ↗

    Claim page

  2. ^DeveloperCookie Clicker main.js v2.058
    How we know

    The changelog dates the launch to 8 August 2013; Orteil says he made the original “in a couple hours, for laughs”.

    made <a href="https://orteil.dashnet.org/experiments/cookie/" target="_blank">the game</a> in a couple hours, for laughs
    main.js#L2020-L2021 · archived copy ↗

    Claim page

  3. ^DeveloperCookie Clicker main.js v2.058
    How we know

    The changelog's 28 September 2019 entry announces the official Android version, with iOS to follow.

    also released the official Android version of Cookie Clicker
    main.js#L1553-L1559 · archived copy ↗

    Claim page

  4. ^DeveloperCookie Clicker main.js v2.058
    How we know

    The changelog's 1 September 2021 entry announces the Steam release and says web and Steam will get the same updates.

    web version and Steam version will receive the same updates from now on
    main.js#L1505-L1507 · archived copy ↗

    Claim page

  5. ^ abVerifiedCookie Clicker main.js v2.058 · Cookie Clicker Wiki, “Building”
    How we know

    One global constant, 1.15, multiplies a building's price for each one already owned.

    Game.priceIncrease=1.15;
    main.js#L7972 · archived copy ↗
    Building Prices · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  6. ^VerifiedCookie Clicker main.js v2.058
    How we know

    Free buildings (Starter kit: 10 Cursors; Starter kitchen: 5 Grandmas) come off the exponent, so the next one costs the base price.

    this.free+=amount;
    main.js#L8266-L8275 · archived copy ↗
    if (Game.Has('Starter kit')) Game.Objects['Cursor'].getFree(10);
    main.js#L3828-L3829 · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  7. ^CodeCookie Clicker main.js v2.058
    How we know

    Upgrades, auras, buffs, and gods multiply the price by factors that don't depend on the count, most of them discounts such as 0.99 or 0.95 and one a rise (the Nasty goblins buff, 1.02), so they scale the curve without changing its 1.15 slope.

    if (Game.Has('Season savings')) price*=0.99; … if (Game.hasBuff('Nasty goblins')) price*=1.02; … price*=Game.eff('buildingCost');
    main.js#L8792-L8814 · archived copy ↗

    Claim page

  8. ^VerifiedCookie Clicker main.js v2.058
    How we know

    Only the Cursor keeps its Game.Object constructor price; the formula overwrites the rest (the Farm's 500 becomes 1,100).

    if (this.n!=0)
    main.js#L8003-L8034 · archived copy ↗
    main.js#L9104 · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  9. ^VerifiedCookie Clicker main.js v2.058
    How we know

    Every building after the Cursor gets its base price from one formula on its index n: (n+9+5max⁡(0,n−5)1.75)×10n×max⁡(1,n−14), rounded to two significant figures, then ×10 at id 16, ×100 at 17, ×1,000 at 18, and ×20,000 at 19.

    this.basePrice=(this.n*1+9+(this.n<5?0:Math.pow(this.n-5,1.75)*5))*Math.pow(10,this.n)*(Math.max(1,this.n-14)); … if (this.id>=16) this.basePrice*=10; … if (this.id>=19) this.basePrice*=20;
    main.js#L8024-L8031 · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  10. ^VerifiedCookie Clicker main.js v2.058 · Cookie Clicker Wiki, “Building”
    How we know

    Base prices (the first one's price) are Cursor 15, Grandma 100, Farm 1,100, Mine 12,000, Factory 130,000, Bank 1.4 million, and so on up to You at 5.4 × 10²⁶.

    new Game.Object('Cursor'…{},15,function(me){
    main.js#L8979 · archived copy ↗
    this.basePrice=(this.n*1+9+(this.n<5?0:Math.pow(this.n-5,1.75)*5))*Math.pow(10,this.n)*(Math.max(1,this.n-14)); … var digits=Math.pow(10,(Math.ceil(Math.log(Math.ceil(this.basePrice))/Math.LN10)))/100; this.basePrice=Math.round(this.basePrice/digits)*digits; if (this.id>=16) this.basePrice*=10; if (this.id>=17) this.basePrice*=10; if (this.id>=18) this.basePrice*=10; if (this.id>=19) this.basePrice*=20;
    main.js#L8024-L8031 · archived copy ↗
    buildings table, “Base Cost” column · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  11. ^VerifiedCookie Clicker main.js v2.058
    How we know

    Base production before upgrades is 0.1 cookies/s for the Cursor, set in its own production function, and ⌈10⋅nn/2+2⌉/10 to two significant figures for building n: Grandma 1, Farm 8, Mine 47, Factory 260, and so on up to You at 5.1 × 10¹⁴.

    this.baseCps=Math.ceil((Math.pow(this.n*1,this.n*0.5+2))*10)/10;//0.45 used to be 0.5
    main.js#L8018-L8022 · archived copy ↗
    return me.baseCps*mult;
    main.js#L9104-L9109 · archived copy ↗
    return Game.ComputeCps(0.1,
    main.js#L9001 · archived copy ↗
    return ((base)*(Math.pow(2,mult))+bonus);
    main.js#L8912-L8916 · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  12. ^CodeCookie Clicker main.js v2.058
    How we know

    Each type's production is its count times its stored rate per building, summed into cookies per second, so before upgrades income grows linearly with count.

    me.storedTotalCps=me.amount*me.storedCps;
    main.js#L5276-L5285 · archived copy ↗

    Claim page

  13. ^VerifiedCookie Clicker main.js v2.058 · Cookie Clicker Wiki, “Building”
    How we know

    A building's next price is ⌈base×1.15max⁡(0,owned−free)⌉, with discounts applied before rounding.

    var price=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,this.amount-this.free));
    main.js#L8090-L8095 · archived copy ↗
    \text {Price} = \text {Base cost} \times 1.15 ^ {M-F}
    Building Prices · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  14. ^VerifiedCookie Clicker main.js v2.058 · Pecorella 2016 · Cookie Clicker Wiki, “Building”
    How we know

    The shown bulk price is the geometric sum b⋅ra⋅(rk−1)/(r−1), discounted and rounded up once: 20.30× the next single price for 10, and 7.83 million× for 100.

    price+=this.basePrice*Math.pow(Game.priceIncrease,Math.max(0,i-this.free));
    main.js#L8096-L8105 · archived copy ↗
    $cost = b * \frac{r^k(r^n-1)}{r-1}$
    “BONUS CONTENT!” · archived copy ↗
    \text {Price of Buy 10} = \text {Price} \times 20.303718238
    Building Prices · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  15. ^ abVerifiedCookie Clicker main.js v2.058
    How we know

    buy() charges each unit's rounded-up price in turn and ignores the shown total: 10 Grandmas from zero cost 2,035, not 2,031, and 2,030 cookies still buy 9.

    if (Game.cookies>=price)
    main.js#L8125-L8152 · archived copy ↗
    Game.ObjectsById[what].buy();
    main.js#L8898-L8901 · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  16. ^ abVerifiedCookie Clicker main.js v2.058
    How we know

    Each sale pays 25% of the next one's price, rounded down, about 15% more than the label: selling 1 of 10 Grandmas shows 88 and pays 101.

    price=Math.floor(price*giveBack);
    main.js#L8156-L8176 · archived copy ↗
    var giveBack=0.25;
    main.js#L8106-L8123 · archived copy ↗
    buildings now sell back for 25% of their current price (down from 50%)
    main.js#L1620-L1628 · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  17. ^VerifiedCookie Clicker, 13 Aug 2013 capture
    How we know

    The original (13 August 2013 capture) set each new price to ⌈price×1.1⌉, compounding the rounding: the 51st Cursor cost 2,283, not the unrounded 1,761.

    this.price=Math.ceil(this.price*1.1);
    index.html#L503-L512 · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  18. ^CodeCookie Clicker, 13 Aug 2013 capture
    How we know

    The original version's starting prices were Cursor 15, Grandma 100, Factory 500, Mine 2,000, Shipment 7,000, Alchemy lab 50,000, and Portal 1,000,000.

    new Buyable('Cursor','Autoclicks every 5 seconds.','cursoricon',15,function(){Cursors++;});
    index.html#L521-L582 · archived copy ↗

    Claim page

  19. ^CodeCookie Clicker main.js v1.035
    How we know

    By v1.035 (captured 10 September 2013), the price was base×1.15amount via the same global constant, still unrounded.

    Game.priceIncrease=1.15;
    main.js#L1836 · archived copy ↗
    var price=this.basePrice*Math.pow(Game.priceIncrease,this.amount);
    main.js#L1871-L1876 · archived copy ↗

    Claim page

  20. ^DeveloperCookie Clicker main.js v2.058
    How we know

    The changelog's 24 August 2013 “big update!”, which “revamped the whole game (new graphics, new game mechanics)”, falls between two Wayback captures, the original version of 13 August 2013 and v1.035 of 10 September 2013.

    24/08/2013 - big update!
    main.js#L2014 · archived copy ↗
    revamped the whole game (new graphics, new game mechanics)
    main.js#L2015 · archived copy ↗

    Claim page

  21. ^ abDeveloperCookie Clicker main.js v2.058
    How we know

    The 25 August 2014 “legacy beta, part I” notes say “price and CpS curves revamped”.

    price and CpS curves revamped
    main.js#L1790-L1792 · archived copy ↗

    Claim page

  22. ^CodeCookie Clicker main.js v1.035
    How we know

    In v1.035, the building constructor sets each building's base price to the literal its definition passes, such as the Farm's 500.

    this.basePrice=price;
    main.js#L1841-L1851 · archived copy ↗
    main.js#L2114 · archived copy ↗

    Claim page

Sources

Code

Primary

Secondary