Percentage Calculator - Percent Change, Margin & Markup Online
Calculate percentages, percentage change, increase/decrease, margin vs markup, and percentage difference instantly. All calculations run 100% in your browser — no data sent to any server.
Frequently Asked Questions
What is a percentage calculator?
A percentage calculator is an online tool that helps you perform various percentage-related calculations quickly and accurately. It can answer questions like "What is 15% of 200?", "30 is what percent of 200?", "What is the percentage change from 50 to 75?", and "What is the difference between margin and markup?" Instead of manually applying formulas, you enter two values and get instant results.
How do I use this percentage calculator?
Select the calculation type you need from the tabs at the top: Basic (for simple percentage of a number), Change (for percentage increase, decrease, or change between two values), Difference (for percentage difference between two values), or Margin vs Markup (for business pricing calculations). Enter your values into the input fields and the result appears instantly — no "Calculate" button needed. The formula used is displayed below the result so you can verify the math.
Is my data safe? Does anything get sent to a server?
All calculations are performed 100% in your browser using basic JavaScript arithmetic. No data — including your numbers, results, or calculation history — is ever transmitted to any server. This makes it safe for business-sensitive calculations like pricing strategies, profit margins, and financial analysis.
What is the difference between percentage change and percentage difference?
Percentage change measures how much a value has increased or decreased relative to its original value. It is directional: going from 50 to 75 is a 50% increase, but going from 75 to 50 is a 33.3% decrease. Percentage difference measures how two values differ relative to their average. It is always positive and symmetric: the percentage difference between 50 and 75 is 40%, regardless of order. Use percentage change when there is a clear "before and after" relationship, and percentage difference when comparing two values without a directional context.
What is the difference between margin and markup?
Both margin and markup measure profit, but relative to different base values. Margin is profit as a percentage of revenue (selling price): Margin% = (Profit / Revenue) × 100. Markup is profit as a percentage of cost: Markup% = (Profit / Cost) × 100. For example, if you buy an item for $60 and sell it for $100, your profit is $40. Your margin is 40% (40/100), but your markup is 66.7% (40/60). Margin is always lower than markup for the same transaction.
How do I calculate percentage increase or decrease?
To calculate a percentage increase: multiply the original value by (1 + percentage/100). For example, 200 increased by 15% = 200 × 1.15 = 230. To calculate a percentage decrease: multiply the original value by (1 - percentage/100). For example, 200 decreased by 15% = 200 × 0.85 = 170. To find what percentage one value changed to another: Percentage Change = ((New - Old) / |Old|) × 100.
Can this calculator handle negative numbers?
Yes. The calculator correctly handles negative numbers in all modes. For percentage change, going from -10 to -5 is a 50% increase (the value moved closer to zero). Going from -10 to -20 is a 100% decrease. The formulas work mathematically with negative values, and the tool clearly labels whether the result represents an increase or decrease.
Code Examples
// Percentage calculations in JavaScript
// What is X% of Y?
function whatIsPercentOf(percent, base) {
return base * (percent / 100);
}
console.log(whatIsPercentOf(15, 200)); // 30
// X is what % of Y?
function whatPercentIsXOfY(value, total) {
if (total === 0) throw new Error('Total cannot be zero');
return (value / total) * 100;
}
console.log(whatPercentIsXOfY(30, 200)); // 15
// X is Y% of what?
function xIsPercentOfWhat(value, percent) {
if (percent === 0) throw new Error('Percentage cannot be zero');
return value / (percent / 100);
}
console.log(xIsPercentOfWhat(30, 15)); // 200
// Percentage change
function percentageChange(oldValue, newValue) {
if (oldValue === 0) throw new Error('Old value cannot be zero');
return ((newValue - oldValue) / Math.abs(oldValue)) * 100;
}
console.log(percentageChange(50, 75)); // 50
console.log(percentageChange(75, 50)); // -33.333...
// Percentage increase / decrease
function percentageIncrease(original, percent) {
return original * (1 + percent / 100);
}
function percentageDecrease(original, percent) {
return original * (1 - percent / 100);
}
console.log(percentageIncrease(200, 15)); // 230
console.log(percentageDecrease(200, 15)); // 170
// Percentage difference
function percentageDifference(value1, value2) {
const avg = (value1 + value2) / 2;
if (avg === 0) return 0;
return (Math.abs(value1 - value2) / avg) * 100;
}
console.log(percentageDifference(50, 75)); // 40
// Margin vs Markup
function marginAndMarkup(cost, revenue) {
const profit = revenue - cost;
const margin = revenue !== 0 ? (profit / revenue) * 100 : 0;
const markup = cost !== 0 ? (profit / cost) * 100 : 0;
return { profit, margin, markup };
}
console.log(marginAndMarkup(60, 100));
// { profit: 40, margin: 40, markup: 66.666... }