Discount Calculator
Calculate sale prices and savings from percentage discounts. Perfect for shopping, sales planning, and comparing deals.
Discount Formula
| Calculation | Formula |
|---|---|
| Discount amount | Original × (Discount% / 100) |
| Sale price | Original - Discount amount |
| Sale price (direct) | Original × (1 - Discount% / 100) |
Discount Examples
| Original | Discount | You Save | Final Price |
|---|---|---|---|
| $100 | 20% | $20 | $80 |
| $50 | 30% | $15 | $35 |
| $200 | 50% | $100 | $100 |
| $75 | 15% | $11.25 | $63.75 |
Implementation
``javascript
function calculateDiscount(originalPrice, discountPercent) {
const discountAmount = originalPrice * (discountPercent / 100);
const salePrice = originalPrice - discountAmount;
return { discountAmount, salePrice };
}
``
Stacking Discounts
Multiple discounts are applied sequentially, not added. A 20% discount followed by 10% off is not 30% total—it's 28% (100 × 0.80 × 0.90 = 72, so 28% off).