Discount Calculator Formula

Understand the math behind the discount calculator. Each variable explained with a worked example.

Formulas Used

You Save

savings = original_price * discount_percent / 100

Sale Price

final_price = original_price - savings

Variables

VariableDescriptionDefault
original_priceOriginal Price(USD)120
discount_percentDiscount(%)25

How It Works

How Discounts Are Calculated

Savings = Original Price × Discount% / 100

Sale Price = Original Price - Savings

Worked Example

A $120 item at 25% off.

original_price = 120discount_percent = 25
  1. 01Savings = $120 × 25% = $30
  2. 02Sale price = $120 - $30 = $90

Ready to run the numbers?

Open Discount Calculator