The three formulas that cover most questions
Almost every everyday percentage question is one of three operations. Mixing them up, or using the wrong base, produces numbers that look plausible and are wrong by a large margin.
| Question | Formula | Example | Result |
|---|---|---|---|
| What is X% of Y? | X / 100 × Y | 15% of 240 | 36 |
| X is what percent of Y? | X / Y × 100 | 36 of 240 | 15% |
| Change from A to B | (B − A) / A × 100 | 240 to 300 | +25% |
The first formula answers a share of a total. The second compares a part with the whole and expresses it as a percentage. The third compares two values over time, with the starting value as the reference. In code, keeping the three separate and naming the variables part, whole, oldValue and newValue prevents most mistakes.
Concrete cases: 15% of 240 = 36; 36 is 15% of 240; a price moving from 240 to 300 is a rise of 25%.
Always divide by the original value
A percentage change uses the starting value, not the ending value and not the average of the two. A rise from 240 to 300 is +25%, because 60 divided by 240 is 0.25. The reverse trip from 300 to 240 is a fall of 20%, because 60 divided by 300 is 0.20. The absolute change is identical, but the percentages differ, and that asymmetry is not a bug.
This is why a 20% discount followed by a 20% increase does not return to the original price. On a 100 unit item, the discount brings the price to 80; adding 20% of 80 gives 96, not 100. Each percentage is applied to a different base, and no single percentage can undo the other unless you solve for the correct factor.
Percentage points versus percent
A change from 4% to 5% is one percentage point, but it is a 25% relative increase, because 1 divided by 4 is 0.25. The distinction matters in interest rates, election polling, conversion rates and medical statistics, where both numbers are already percentages.
Example: an interest rate moving from 2.5% to 3.0% is +0.5 percentage points and +20% relative. Both statements are true; only one is what most readers assume. Say "percentage points" whenever the values are percentages, and reserve "percent" for a relative change in the underlying value.
Markup, margin and the base that changes
Markup and margin both describe the gap between cost and price, but they divide by different numbers. If an item costs 80 and sells for 100, the gap is 20. As markup, it is 20 divided by cost 80, or 25%. As margin, it is 20 divided by price 100, or 20%. Saying "a 25% margin" when you mean markup overstates profitability by five points.
The formulas are not interchangeable. To add a 30% markup to a cost of 80, multiply by 1.30 and price at 104. To achieve a 30% margin, divide the cost by (1 − 0.30), which gives 114.29. The margin formula needs the price in the denominator, so it cannot be written as a simple multiplication of cost.
| Term | Formula | On cost 80, price 100 |
|---|---|---|
| Markup | (price − cost) / cost | 25% |
| Margin | (price − cost) / price | 20% |
| Price for 30% markup | cost × 1.30 | 104.00 |
| Price for 30% margin | cost / 0.70 | 114.29 |
Successive discounts do not add
Two discounts of 20% and 10% are not a 30% discount. They multiply. A 100 unit price falls to 80 after the first discount, then to 72 after the second, for a total reduction of 28%. The combined factor is 0.8 × 0.9 = 0.72, and the combined percentage is 1 − 0.72 = 0.28. The order does not matter because multiplication is commutative, but the advertised saving does.
The same multiplication applies to increases. Two successive 10% raises produce 1.10 × 1.10 = 1.21, a 21% total increase rather than 20%. A 20% rise followed by a 20% fall gives 1.20 × 0.80 = 0.96, a net loss of 4%. Whenever percentages apply to a changing base, add the factors, not the rates.
Rounding errors and the zero base
Round only the final answer. Rounding shares before summing can produce a total that misses 100. Three equal parts are 33.33% each, which sums to 99.99%; displaying one decimal place gives 33.3 + 33.3 + 33.3 = 99.9. The usual fix is the largest remainder method: round down first, then distribute the remaining points to the shares with the largest fractional parts.
Two bases need explicit handling. A change from zero is undefined, because the denominator is zero; do not display infinity or a huge percentage as if it were meaningful. A negative base also flips the intuition: moving from −10 to −5 is a 50% increase in the arithmetic sense, even though the value is still negative. State the convention in the label.
Checklist for percentage work
- Identify which of the three formulas applies. Share, part-of-whole and change are different questions.
- Divide by the original value for a change rate, never by the new value or the average.
- Say percentage points when both values are already percentages.
- Do not confuse markup with margin. They use cost and price as different denominators.
- Multiply successive rates. Discounts and increases compound; they do not sum.
- Round once and handle a zero base. Decide what undefined input should display.
Working backwards from a result
Many real questions run in reverse. If a price after a 20% discount is 80, the original was 80 / 0.80 = 100, not 80 × 1.20 = 96. If a value is 15% more than another and equals 230, the base is 230 / 1.15 = 200. If a gross price of 120 includes 20% tax, the net amount is 120 / 1.20 = 100, and the tax is 20 — not 24. The rule is the same in every case: divide by the factor that was applied, because multiplying by the complement answers a different question.
Averaging percentages needs weights
You cannot average percentages unless the denominators are equal. A campaign with 10% conversion on 100 visitors and 2% on 1,000 visitors has an overall rate of (10 + 20) / 1,100 = 2.7%, not (10% + 2%) / 2 = 6%. The same trap appears in test scores, response times and error rates: average the counts first, then divide. When someone reports a rise in every subgroup but a fall overall, check whether the mix between groups changed — that is Simpson’s paradox, and it is a weighting problem rather than an arithmetic error.
Percentages in code and spreadsheets
A cell formatted as a percentage still stores a fraction: 25% is 0.25, and typing 25 into a percent-formatted cell gives 2500%. Division by zero returns an error rather than a useful number, so guard the denominator before computing. Integer arithmetic truncates, and in languages where 5 / 2 is 2, a rate of 1.5 becomes 1. Floating point adds its own noise — 0.1 + 0.2 is not exactly 0.3 — so compare with a tolerance and round only for display. For money, use integer cents or a decimal type rather than binary floats; a discount rounded to the nearest cent on every line can drift by more than a cent in the total.
Run all three modes in one place with our percentage calculator: X% of Y, X as a percentage of Y, and the change from A to B with the direction stated. For ratios in design work, see HEX, RGB and HSL with accessible contrast; for file size reductions, see lossy vs lossless image compression.