
Discount calculator
Calculate the price after a discount and the amount saved.
Your inputs stay in your browser.
Method and assumptions
Method version 1.0.0 · Updated
Apply a discount
Formula: Saving = price × rate / 100; sale price = price − saving
One discount from 0 to 100%. The original price is rounded to the chosen precision, then the saving; the sale price is their difference. Example: 100 at 20% off → 80, saving 20. Successive discounts are not automatically added.
- price
- Original price
- rate
- Discount (%)
- precision
- Money decimal places
All amounts use the same currency, without conversion. Choose 0, 2 or 3 decimal places for your needs. Rounded to nearest, ties up.
Calculate with code
These short examples use the same inputs and core calculation as this tool. Adapt validation and formatting to your application.
JavaScript
const price = 80, rate = 15;
const salePrice = price * (1 - rate / 100);
console.log(salePrice); // 68TypeScript
const price = 80, rate = 15;
const salePrice: number = price * (1 - rate / 100);
console.log(salePrice); // 68Python
price, rate = 80, 15
print(price * (1 - rate / 100)) # 68.0Java
double price = 80, rate = 15;
System.out.println(price * (1 - rate / 100)); // 68.0C#
double price = 80, rate = 15;
Console.WriteLine(price * (1 - rate / 100)); // 68