Discount calculator
See what a percent-off deal really leaves you to pay: 15% off 19.99 saves 3.00 and brings the price down to 16.99, exact to the cent. Handy for promotions, checkout previews and homework. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Price
- 100.00
- Percentage
- 10
- Discount amount
- 10.00
- Final price
- 90.00
Shoppers and merchants search for a discount calculator that turns an original price and a percent off into a clear savings amount and final price.
From price and percent to savings and final price
Shoppers and merchants often need the same two answers: how much a percentage discount takes off, and what is left to pay. Type the original price and the percent off, and the calculator returns the discount amount and the final price. A price of 100.00 with 10% off gives a discount of 10.00 and a final price of 90.00; 19.99 with 15% off gives 3.00 and 16.99. Shops use it to check final prices before publishing a percent-off banner, checkouts to preview the amount saved when a coupon applies a simple percentage, and students to check percent-off exercises against answers that are exact to the cent.
Why every result is exact to the cent
The price is first turned into whole cents, so no fraction of a cent can creep in. The discount is the price in cents times the percent divided by 100, rounded half-up, and it is then subtracted from the original price to give the final price. That matches common retail rounding, and both amounts always come back with exactly two decimals. To keep results reliable, the price must be written with at most two decimals or as a whole number, without leading zeros or a plus sign, and the percent must be a whole number from 0 to 100. Anything else is refused rather than silently corrected.
Half-up to the nearest cent
The discount amount is computed as half-up of price cents times percent over one hundred, then subtracted from the original to produce the final price. Examples such as 19.99 at 15 percent become a 3.00 discount and a 16.99 final price, matching common retail rounding.
What you can do with it
Storefront promotions
Show final prices for percent-off campaigns before publishing a banner.
Checkout previews
Estimate the amount saved when a coupon applies a simple percentage.
Homework and training
Check percent-off exercises with cent-accurate half-up answers.
FAQ
How is the discount rounded?
Half-up to the nearest cent using integer arithmetic only.
Can I use a floating-point price?
No. Use a money string or a non-negative integer of whole units.
Is the output a float?
No. Money fields are strings with two decimals; percent is an integer.
How do I calculate 15% off 19.99?
Enter 19.99 as the price and 15 as the percent. The discount comes to 3.00 and the final price to 16.99, rounded to the cent the way most retailers round it.
Which discount percentages can I enter?
Whole numbers from 0 to 100. A percentage with decimals, or one outside that range, is refused with a clear message instead of being quietly adjusted.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/dev/discount-calculator \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"price":"100.00","percent":10}'const res = await fetch("https://api.kit.forhosting.com/dev/discount-calculator", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"price": "100.00",
"percent": 10
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/dev/discount-calculator",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"price": "100.00",
"percent": 10
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/dev/discount-calculator", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"price":"100.00","percent":10}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"price":"100.00","percent":10}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/dev/discount-calculator", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"price": "100.00",
"percent": 10
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "dev.discount_calculator",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_price_cents | 999999999999999 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
This tool uses integer cents and half-up rounding so the free browser tool and the API always agree on every cent.
Canonical money input, no float surprises
Send the original price as a digit string with optional one or two decimals, or as a non-negative whole integer. Internally the amount is converted to integer cents before any arithmetic. Float JSON values, leading zeros, plus signs and more than two fractional digits are rejected.
Percent off from zero to one hundred
The discount percent is an integer from 0 through 100 inclusive. Digit-only strings are accepted and normalized to an integer. Floats, booleans and out-of-range values return typed invalid_input instead of clamping silently.
Stable string outputs
price, discount_amount and final_price are always returned as strings with exactly two decimal places. percent is returned as an integer so clients never re-parse a float percentage. Missing fields and negatives produce invalid_input with stable match substrings for tests.
Integration use cases
Automated checks
Assert discount_amount and final_price in CI golden fixtures.
Technical questions
What percent range is allowed?
Integers from 0 to 100 inclusive.
What if the price is negative?
invalid_input with match negativo.
Is it free in the browser?
Yes on desktop and mobile. The native app uses the API at $0.002.