[{"data":1,"prerenderedAt":903},["ShallowReactive",2],{"guide-percentage-discount-calculation":3},{"id":4,"title":5,"body":6,"date":895,"description":896,"extension":897,"meta":898,"navigation":135,"path":899,"readingTime":270,"seo":900,"stem":901,"__hash__":902},"guides\u002Fguides\u002Fpercentage-discount-calculation.md","Calculating Percentage Discounts",{"type":7,"value":8,"toc":889},"minimark",[9,13,18,21,27,37,42,47,50,160,167,171,174,180,303,306,309,315,323,326,332,335,416,419,423,429,435,632,635,641,715,721,725,728,874,877,885],[10,11,12],"p",{},"Calculating a percentage discount sounds straightforward — until you realize that \"30% off\" can be computed two different ways, compound discounts do not simply add up, and rounding errors at scale turn into real money. Whether you are building an e-commerce checkout, writing pricing logic, or just trying to figure out the real price at a sale, understanding the mechanics of discount math prevents expensive mistakes.",[14,15,17],"h2",{"id":16},"the-two-methods-multiply-vs-subtract","The Two Methods: Multiply vs Subtract",[10,19,20],{},"Given a price of $80 and a 25% discount, most people compute the discount amount first, then subtract:",[10,22,23],{},[24,25,26],"strong",{},"Subtract method:",[28,29,30,34],"ol",{},[31,32,33],"li",{},"Discount amount = $80 × 0.25 = $20",[31,35,36],{},"Sale price = $80 − $20 = $60",[10,38,39],{},[24,40,41],{},"Multiply method:",[28,43,44],{},[31,45,46],{},"Sale price = $80 × (1 − 0.25) = $80 × 0.75 = $60",[10,48,49],{},"Both produce the same result for a single discount. The multiply method is preferable in code because it avoids an intermediate subtraction step and composes naturally when discounts stack:",[51,52,57],"pre",{"className":53,"code":54,"language":55,"meta":56,"style":56},"language-javascript shiki shiki-themes github-light github-dark","function applyDiscount(price, discountPercent) {\n  return price * (1 - discountPercent \u002F 100)\n}\n\napplyDiscount(80, 25)  \u002F\u002F 60\n","javascript","",[58,59,60,90,124,130,137],"code",{"__ignoreMap":56},[61,62,65,69,73,77,81,84,87],"span",{"class":63,"line":64},"line",1,[61,66,68],{"class":67},"szBVR","function",[61,70,72],{"class":71},"sScJk"," applyDiscount",[61,74,76],{"class":75},"sVt8B","(",[61,78,80],{"class":79},"s4XuR","price",[61,82,83],{"class":75},", ",[61,85,86],{"class":79},"discountPercent",[61,88,89],{"class":75},") {\n",[61,91,93,96,99,102,105,109,112,115,118,121],{"class":63,"line":92},2,[61,94,95],{"class":67},"  return",[61,97,98],{"class":75}," price ",[61,100,101],{"class":67},"*",[61,103,104],{"class":75}," (",[61,106,108],{"class":107},"sj4cs","1",[61,110,111],{"class":67}," -",[61,113,114],{"class":75}," discountPercent ",[61,116,117],{"class":67},"\u002F",[61,119,120],{"class":107}," 100",[61,122,123],{"class":75},")\n",[61,125,127],{"class":63,"line":126},3,[61,128,129],{"class":75},"}\n",[61,131,133],{"class":63,"line":132},4,[61,134,136],{"emptyLinePlaceholder":135},true,"\n",[61,138,140,143,145,148,150,153,156],{"class":63,"line":139},5,[61,141,142],{"class":71},"applyDiscount",[61,144,76],{"class":75},[61,146,147],{"class":107},"80",[61,149,83],{"class":75},[61,151,152],{"class":107},"25",[61,154,155],{"class":75},")  ",[61,157,159],{"class":158},"sJ8bj","\u002F\u002F 60\n",[10,161,162,163,166],{},"The subtract method becomes problematic when people try to combine discounts by adding the percentages. A 25% discount plus a 10% loyalty discount is ",[24,164,165],{},"not"," 35% off — it is a sequential application that yields a different result, which leads to the next section.",[14,168,170],{"id":169},"compound-discounts","Compound Discounts",[10,172,173],{},"When multiple discounts apply, the order and method of combination matter.",[10,175,176,179],{},[24,177,178],{},"Sequential discounts"," apply one after another:",[51,181,183],{"className":53,"code":182,"language":55,"meta":56,"style":56},"function compoundDiscount(price, ...discounts) {\n  return discounts.reduce(\n    (p, d) => p * (1 - d \u002F 100),\n    price\n  )\n}\n\ncompoundDiscount(100, 25, 10)  \u002F\u002F 67.5, not 65\n",[58,184,185,206,219,258,263,268,273,278],{"__ignoreMap":56},[61,186,187,189,192,194,196,198,201,204],{"class":63,"line":64},[61,188,68],{"class":67},[61,190,191],{"class":71}," compoundDiscount",[61,193,76],{"class":75},[61,195,80],{"class":79},[61,197,83],{"class":75},[61,199,200],{"class":67},"...",[61,202,203],{"class":79},"discounts",[61,205,89],{"class":75},[61,207,208,210,213,216],{"class":63,"line":92},[61,209,95],{"class":67},[61,211,212],{"class":75}," discounts.",[61,214,215],{"class":71},"reduce",[61,217,218],{"class":75},"(\n",[61,220,221,224,226,228,231,234,237,240,242,244,246,248,251,253,255],{"class":63,"line":126},[61,222,223],{"class":75},"    (",[61,225,10],{"class":79},[61,227,83],{"class":75},[61,229,230],{"class":79},"d",[61,232,233],{"class":75},") ",[61,235,236],{"class":67},"=>",[61,238,239],{"class":75}," p ",[61,241,101],{"class":67},[61,243,104],{"class":75},[61,245,108],{"class":107},[61,247,111],{"class":67},[61,249,250],{"class":75}," d ",[61,252,117],{"class":67},[61,254,120],{"class":107},[61,256,257],{"class":75},"),\n",[61,259,260],{"class":63,"line":132},[61,261,262],{"class":75},"    price\n",[61,264,265],{"class":63,"line":139},[61,266,267],{"class":75},"  )\n",[61,269,271],{"class":63,"line":270},6,[61,272,129],{"class":75},[61,274,276],{"class":63,"line":275},7,[61,277,136],{"emptyLinePlaceholder":135},[61,279,281,284,286,289,291,293,295,298,300],{"class":63,"line":280},8,[61,282,283],{"class":71},"compoundDiscount",[61,285,76],{"class":75},[61,287,288],{"class":107},"100",[61,290,83],{"class":75},[61,292,152],{"class":107},[61,294,83],{"class":75},[61,296,297],{"class":107},"10",[61,299,155],{"class":75},[61,301,302],{"class":158},"\u002F\u002F 67.5, not 65\n",[10,304,305],{},"Step by step: $100 → 25% off = $75 → 10% off $75 = $67.50.",[10,307,308],{},"Many people mistakenly calculate $100 × (1 − 0.35) = $65. The difference of $2.50 per item becomes substantial at volume.",[10,310,311,314],{},[24,312,313],{},"Why sequential application is called \"stacking\":"," Each subsequent discount applies to a smaller base, so the combined effect is always less than the sum of the individual percentages. The combined rate formula is:",[51,316,321],{"className":317,"code":319,"language":320},[318],"language-text","Combined rate = 1 - (1 - d₁)(1 - d₂)(1 - d₃)...\n","text",[58,322,319],{"__ignoreMap":56},[10,324,325],{},"For 25% + 10%:",[51,327,330],{"className":328,"code":329,"language":320},[318],"Combined = 1 - (0.75 × 0.90) = 1 - 0.675 = 0.325 = 32.5%\n",[58,331,329],{"__ignoreMap":56},[10,333,334],{},"Not 35%. The gap widens as percentages increase.",[336,337,338,357],"table",{},[339,340,341],"thead",{},[342,343,344,348,351,354],"tr",{},[345,346,347],"th",{},"Discounts",[345,349,350],{},"Sum of %",[345,352,353],{},"Actual Combined %",[345,355,356],{},"Difference",[358,359,360,375,389,403],"tbody",{},[342,361,362,366,369,372],{},[363,364,365],"td",{},"10% + 10%",[363,367,368],{},"20%",[363,370,371],{},"19%",[363,373,374],{},"1%",[342,376,377,380,383,386],{},[363,378,379],{},"25% + 10%",[363,381,382],{},"35%",[363,384,385],{},"32.5%",[363,387,388],{},"2.5%",[342,390,391,394,397,400],{},[363,392,393],{},"50% + 50%",[363,395,396],{},"100%",[363,398,399],{},"75%",[363,401,402],{},"25%",[342,404,405,408,410,413],{},[363,406,407],{},"50% + 30% + 20%",[363,409,396],{},[363,411,412],{},"72%",[363,414,415],{},"28%",[10,417,418],{},"That last row demonstrates why \"100% off\" via three stacked discounts is mathematically impossible — you always retain at least a fraction of the original price.",[14,420,422],{"id":421},"common-retail-math-mistakes","Common Retail Math Mistakes",[10,424,425,428],{},[24,426,427],{},"Mistake 1: Adding discounts instead of multiplying."," As shown above, this overestimates the discount. In regulated environments, advertising \"35% off\" when the actual combined discount is 32.5% can be a legal compliance issue.",[10,430,431,434],{},[24,432,433],{},"Mistake 2: Rounding before multiplying."," Rounding intermediate values in sequential discounts produces different final prices than rounding only at the end.",[51,436,438],{"className":53,"code":437,"language":55,"meta":56,"style":56},"\u002F\u002F Wrong: rounds after each step\nconst step1 = Math.round(100 * 0.75)  \u002F\u002F 75\nconst salePrice = Math.round(step1 * 0.90)  \u002F\u002F 68 (wrong!)\n\n\u002F\u002F Right: rounds only at the end\nconst salePrice = Math.round(100 * 0.75 * 0.90)  \u002F\u002F 68\n\u002F\u002F Actually same here, but with odd numbers:\nconst step1 = Math.round(99 * 0.75)  \u002F\u002F 74\nconst wrong = Math.round(step1 * 0.90)  \u002F\u002F 67\n\nconst right = Math.round(99 * 0.75 * 0.90)  \u002F\u002F 67\n",[58,439,440,445,477,503,507,512,541,546,572,597,602],{"__ignoreMap":56},[61,441,442],{"class":63,"line":64},[61,443,444],{"class":158},"\u002F\u002F Wrong: rounds after each step\n",[61,446,447,450,453,456,459,462,464,466,469,472,474],{"class":63,"line":92},[61,448,449],{"class":67},"const",[61,451,452],{"class":107}," step1",[61,454,455],{"class":67}," =",[61,457,458],{"class":75}," Math.",[61,460,461],{"class":71},"round",[61,463,76],{"class":75},[61,465,288],{"class":107},[61,467,468],{"class":67}," *",[61,470,471],{"class":107}," 0.75",[61,473,155],{"class":75},[61,475,476],{"class":158},"\u002F\u002F 75\n",[61,478,479,481,484,486,488,490,493,495,498,500],{"class":63,"line":126},[61,480,449],{"class":67},[61,482,483],{"class":107}," salePrice",[61,485,455],{"class":67},[61,487,458],{"class":75},[61,489,461],{"class":71},[61,491,492],{"class":75},"(step1 ",[61,494,101],{"class":67},[61,496,497],{"class":107}," 0.90",[61,499,155],{"class":75},[61,501,502],{"class":158},"\u002F\u002F 68 (wrong!)\n",[61,504,505],{"class":63,"line":132},[61,506,136],{"emptyLinePlaceholder":135},[61,508,509],{"class":63,"line":139},[61,510,511],{"class":158},"\u002F\u002F Right: rounds only at the end\n",[61,513,514,516,518,520,522,524,526,528,530,532,534,536,538],{"class":63,"line":270},[61,515,449],{"class":67},[61,517,483],{"class":107},[61,519,455],{"class":67},[61,521,458],{"class":75},[61,523,461],{"class":71},[61,525,76],{"class":75},[61,527,288],{"class":107},[61,529,468],{"class":67},[61,531,471],{"class":107},[61,533,468],{"class":67},[61,535,497],{"class":107},[61,537,155],{"class":75},[61,539,540],{"class":158},"\u002F\u002F 68\n",[61,542,543],{"class":63,"line":275},[61,544,545],{"class":158},"\u002F\u002F Actually same here, but with odd numbers:\n",[61,547,548,550,552,554,556,558,560,563,565,567,569],{"class":63,"line":280},[61,549,449],{"class":67},[61,551,452],{"class":107},[61,553,455],{"class":67},[61,555,458],{"class":75},[61,557,461],{"class":71},[61,559,76],{"class":75},[61,561,562],{"class":107},"99",[61,564,468],{"class":67},[61,566,471],{"class":107},[61,568,155],{"class":75},[61,570,571],{"class":158},"\u002F\u002F 74\n",[61,573,575,577,580,582,584,586,588,590,592,594],{"class":63,"line":574},9,[61,576,449],{"class":67},[61,578,579],{"class":107}," wrong",[61,581,455],{"class":67},[61,583,458],{"class":75},[61,585,461],{"class":71},[61,587,492],{"class":75},[61,589,101],{"class":67},[61,591,497],{"class":107},[61,593,155],{"class":75},[61,595,596],{"class":158},"\u002F\u002F 67\n",[61,598,600],{"class":63,"line":599},10,[61,601,136],{"emptyLinePlaceholder":135},[61,603,605,607,610,612,614,616,618,620,622,624,626,628,630],{"class":63,"line":604},11,[61,606,449],{"class":67},[61,608,609],{"class":107}," right",[61,611,455],{"class":67},[61,613,458],{"class":75},[61,615,461],{"class":71},[61,617,76],{"class":75},[61,619,562],{"class":107},[61,621,468],{"class":67},[61,623,471],{"class":107},[61,625,468],{"class":67},[61,627,497],{"class":107},[61,629,155],{"class":75},[61,631,596],{"class":158},[10,633,634],{},"The discrepancy grows with more decimal places and more discount layers. Always round only the final result.",[10,636,637,640],{},[24,638,639],{},"Mistake 3: Confusing markup with margin."," A 50% markup on a $100 cost yields $150. A 50% margin on a $150 sale price means the cost was $75. These are different calculations:",[51,642,644],{"className":53,"code":643,"language":55,"meta":56,"style":56},"\u002F\u002F Markup: add to cost\nconst markupPrice = 100 * (1 + 0.50)  \u002F\u002F 150\n\n\u002F\u002F Margin: solve for price given margin requirement\nconst marginPrice = 100 \u002F (1 - 0.50)  \u002F\u002F 200\n",[58,645,646,651,679,683,688],{"__ignoreMap":56},[61,647,648],{"class":63,"line":64},[61,649,650],{"class":158},"\u002F\u002F Markup: add to cost\n",[61,652,653,655,658,660,662,664,666,668,671,674,676],{"class":63,"line":92},[61,654,449],{"class":67},[61,656,657],{"class":107}," markupPrice",[61,659,455],{"class":67},[61,661,120],{"class":107},[61,663,468],{"class":67},[61,665,104],{"class":75},[61,667,108],{"class":107},[61,669,670],{"class":67}," +",[61,672,673],{"class":107}," 0.50",[61,675,155],{"class":75},[61,677,678],{"class":158},"\u002F\u002F 150\n",[61,680,681],{"class":63,"line":126},[61,682,136],{"emptyLinePlaceholder":135},[61,684,685],{"class":63,"line":132},[61,686,687],{"class":158},"\u002F\u002F Margin: solve for price given margin requirement\n",[61,689,690,692,695,697,699,702,704,706,708,710,712],{"class":63,"line":139},[61,691,449],{"class":67},[61,693,694],{"class":107}," marginPrice",[61,696,455],{"class":67},[61,698,120],{"class":107},[61,700,701],{"class":67}," \u002F",[61,703,104],{"class":75},[61,705,108],{"class":107},[61,707,111],{"class":67},[61,709,673],{"class":107},[61,711,155],{"class":75},[61,713,714],{"class":158},"\u002F\u002F 200\n",[10,716,717,720],{},[24,718,719],{},"Mistake 4: Percentage off vs percentage of."," \"30% off the original price\" is different from \"pay 30% of the original price.\" The first gives you a 30% discount; the second gives you a 70% discount. Ambiguous copy leads to customer complaints and refund requests.",[14,722,724],{"id":723},"tax-after-discount","Tax After Discount",[10,726,727],{},"In most jurisdictions, sales tax applies to the discounted price, not the original. The calculation sequence is:",[51,729,731],{"className":53,"code":730,"language":55,"meta":56,"style":56},"function finalPrice(originalPrice, discountPercent, taxRate) {\n  const discounted = originalPrice * (1 - discountPercent \u002F 100)\n  const withTax = discounted * (1 + taxRate \u002F 100)\n  return Math.round(withTax * 100) \u002F 100  \u002F\u002F round to cents\n}\n\nfinalPrice(80, 25, 8.25)  \u002F\u002F 64.95\n\u002F\u002F 80 × 0.75 = 60 → 60 × 1.0825 = 64.95\n",[58,732,733,756,785,814,838,842,846,869],{"__ignoreMap":56},[61,734,735,737,740,742,745,747,749,751,754],{"class":63,"line":64},[61,736,68],{"class":67},[61,738,739],{"class":71}," finalPrice",[61,741,76],{"class":75},[61,743,744],{"class":79},"originalPrice",[61,746,83],{"class":75},[61,748,86],{"class":79},[61,750,83],{"class":75},[61,752,753],{"class":79},"taxRate",[61,755,89],{"class":75},[61,757,758,761,764,766,769,771,773,775,777,779,781,783],{"class":63,"line":92},[61,759,760],{"class":67},"  const",[61,762,763],{"class":107}," discounted",[61,765,455],{"class":67},[61,767,768],{"class":75}," originalPrice ",[61,770,101],{"class":67},[61,772,104],{"class":75},[61,774,108],{"class":107},[61,776,111],{"class":67},[61,778,114],{"class":75},[61,780,117],{"class":67},[61,782,120],{"class":107},[61,784,123],{"class":75},[61,786,787,789,792,794,797,799,801,803,805,808,810,812],{"class":63,"line":126},[61,788,760],{"class":67},[61,790,791],{"class":107}," withTax",[61,793,455],{"class":67},[61,795,796],{"class":75}," discounted ",[61,798,101],{"class":67},[61,800,104],{"class":75},[61,802,108],{"class":107},[61,804,670],{"class":67},[61,806,807],{"class":75}," taxRate ",[61,809,117],{"class":67},[61,811,120],{"class":107},[61,813,123],{"class":75},[61,815,816,818,820,822,825,827,829,831,833,835],{"class":63,"line":132},[61,817,95],{"class":67},[61,819,458],{"class":75},[61,821,461],{"class":71},[61,823,824],{"class":75},"(withTax ",[61,826,101],{"class":67},[61,828,120],{"class":107},[61,830,233],{"class":75},[61,832,117],{"class":67},[61,834,120],{"class":107},[61,836,837],{"class":158},"  \u002F\u002F round to cents\n",[61,839,840],{"class":63,"line":139},[61,841,129],{"class":75},[61,843,844],{"class":63,"line":270},[61,845,136],{"emptyLinePlaceholder":135},[61,847,848,851,853,855,857,859,861,864,866],{"class":63,"line":275},[61,849,850],{"class":71},"finalPrice",[61,852,76],{"class":75},[61,854,147],{"class":107},[61,856,83],{"class":75},[61,858,152],{"class":107},[61,860,83],{"class":75},[61,862,863],{"class":107},"8.25",[61,865,155],{"class":75},[61,867,868],{"class":158},"\u002F\u002F 64.95\n",[61,870,871],{"class":63,"line":280},[61,872,873],{"class":158},"\u002F\u002F 80 × 0.75 = 60 → 60 × 1.0825 = 64.95\n",[10,875,876],{},"Always apply tax after discounts, not before. Taxing the pre-discount amount and then applying the discount violates tax regulations in most states.",[10,878,879,880,884],{},"Quickly verify any discount calculation using the percentage calculator at ",[881,882,883],"a",{"href":883},"\u002Ftools\u002Fpercentage-calculator",", which handles percentage off, percentage change, and compound discount scenarios with step-by-step breakdowns.",[886,887,888],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":56,"searchDepth":92,"depth":92,"links":890},[891,892,893,894],{"id":16,"depth":92,"text":17},{"id":169,"depth":92,"text":170},{"id":421,"depth":92,"text":422},{"id":723,"depth":92,"text":724},"2026-05-28","Multiply vs subtract method for discounts, compound discounts, and common retail math mistakes.","md",{},"\u002Fguides\u002Fpercentage-discount-calculation",{"title":5,"description":896},"guides\u002Fpercentage-discount-calculation","fh1yMyQT3VRvuOSZfsu4iSnnrg2e4qHeF9CngUNpL1k",1780401335744]