DEV Community

Michael Lip
Michael Lip

Posted on • Originally published at zovo.one

Three Percentage Formulas That Cover Every Situation

Every percentage problem reduces to one of three questions. What is X percent of Y. What percent is X of Y. Y is X percent of what number. Three formulas. That covers every percentage calculation you will ever encounter.

The three formulas

What is X% of Y?

Result = (X / 100) * Y
What is 15% of 200? → (15/100) * 200 = 30
Enter fullscreen mode Exit fullscreen mode

What percent is X of Y?

Percent = (X / Y) * 100
What percent is 30 of 200? → (30/200) * 100 = 15%
Enter fullscreen mode Exit fullscreen mode

Y is X% of what?

Total = Y / (X / 100)
30 is 15% of what? → 30 / (15/100) = 200
Enter fullscreen mode Exit fullscreen mode
function percentOf(percent, total) {
  return (percent / 100) * total;
}

function whatPercent(part, total) {
  return (part / total) * 100;
}

function percentOfWhat(part, percent) {
  return part / (percent / 100);
}
Enter fullscreen mode Exit fullscreen mode

Percentage change

Change = ((New - Old) / Old) * 100
Enter fullscreen mode Exit fullscreen mode

From 80 to 100: ((100 - 80) / 80) * 100 = 25% increase
From 100 to 80: ((80 - 100) / 100) * 100 = 20% decrease

Note the asymmetry: a 25% increase followed by a 20% decrease returns to the original value. They are not equal and opposite. This catches people in finance and analytics constantly.

Percentage points vs. percentages

"Market share increased from 20% to 25%."

That is a 5 percentage point increase.
It is a 25% percentage increase (5/20 * 100).

This distinction matters in reporting. "Sales tax increased by 2%" could mean from 8% to 8.16% (2% of 8%) or from 8% to 10% (2 percentage points). Sloppy language creates misunderstandings.

For any percentage calculation with clear results, I built a calculator at zovo.one/free-tools/percentage-calculator. It handles all three formula types plus percentage change and percentage point conversions.


I'm Michael Lip. I build free developer tools at zovo.one. 500+ tools, all private, all free.

Top comments (0)