DevLab
123
Numbersbeginner

Percentage Calculator

calculate percentages, percentage changes, and ratios

By Bikram NathLast updated

Entering a base value and a percent returns the calculated portion instantly: type 340 and 15 to get 51, plus a reverse confirmation that 51 is 12% of 340 as a cross-check. Multiple modes cover percentage-of, signed percentage change, and ratio-to-percent conversion in one session. That removes the three separate RapidTables lookups most developers make when debugging a discount or commission formula mid-code.

Try it now — free, instant, no signup

What is Percentage Calculator?

The calculator accepts two numbers and a mode, then returns the result alongside the inverse relationship. In percentage-of mode, entering 850 and 12 yields 102 and confirms that 102 is 12% of 850. Percentage-change mode takes a before and after value and returns the signed delta, so 200 to 170 reports -15% rather than 15%.

Developers reach for this when sanity-checking a formula mid-code without switching to a Python REPL or a WolframAlpha query. RapidTables covers similar ground but splits the three calculation types across separate pages, which breaks focus. For anything beyond a quick spot-check, a short Python script or a named-cell spreadsheet keeps a reusable and auditable record.

IEEE 754 doubles surface here the same way they do everywhere in JavaScript: 1 divided by 3 times 100 gives 33.333333333333336%, not 33.33%. The display rounds for readability, but copying the raw value into another system expecting a clean decimal carries those trailing digits along. Rounding explicitly to the required precision before passing a percentage to a database DECIMAL column or an API payload is the caller's responsibility, not the tool's.

When to use Percentage Calculator

Verify a discount multiplier before committing a promo rate to a codebase constant or an environment variable.
Audit a reported metric by checking whether a stated percentage increase matches the raw before-and-after numbers in a dataset.
Convert a ratio like 47 passed tests out of 200 into the percentage threshold needed for a CI coverage badge.

Frequently Asked Questions

What is the difference between percentage change and percentage difference, and which does this tool calculate?
Percentage change measures movement relative to a starting point: (new minus old) divided by old, times 100. Percentage difference uses the average of the two values as the denominator, so |a minus b| divided by ((a plus b) / 2), times 100. That makes it symmetric, meaning swapping the two inputs gives the same magnitude. This tool calculates percentage change, not percentage difference, which matters when direction is meaningful, such as tracking revenue growth or a price decline over consecutive periods.
Why does the result sometimes show many decimal places like 33.333333333333336 instead of 33.33?
JavaScript represents all numbers as IEEE 754 64-bit doubles, which cannot store one-third exactly in binary. Multiplying by 100 after the division introduces a rounding error at the last significant bit, producing 33.333333333333336 instead of a clean 33.33. The display rounds for readability, but the underlying floating-point value is unchanged. If you copy that number into a payment system or a database DECIMAL column, round it explicitly to the precision your target system expects before passing it along.
What happens when the starting value for a percentage change is zero?
Division by zero is mathematically undefined, and JavaScript evaluates (new minus 0) / 0 * 100 as Infinity, or NaN when both values are zero. Most calculators show an error or leave the output blank in that case rather than displaying Infinity. If your workflow involves a base value of zero, expressing the change as an absolute delta or a plain ratio is more meaningful than a percentage, since no baseline exists to give the percent figure interpretive weight.
Can this calculate chained or compounded percentage changes, for example a 20% discount followed by a 10% markup?
Not in a single step. A 10% markup applied to a price already reduced by 20% requires two sequential calculations: first find the discounted price, then apply the markup to that intermediate result. No single-mode percentage calculator collapses chained operations into one input without you doing the intermediate arithmetic. For repeated compound percentage work, a short Python snippet or a spreadsheet formula like =B1*(1-0.2)*(1+0.1) is more transparent and less error-prone than running the tool twice and transcribing a value between sessions.
Is the percentage-change result signed, or does it always return a positive number?
The result is signed. A value moving from 200 to 170 returns -15, indicating a 15% decrease. A value moving from 170 to 200 returns approximately 17.65, because the base is now the smaller number and the formula is (new minus old) divided by the absolute value of old, times 100. Some dashboards normalize the display by showing decreases as positive numbers with a separate direction label, but the raw output here preserves the sign so the direction of change is unambiguous.

Related Tools