Percentage Calculator
Calculate percentages, percentage change, and percentage increase/decrease
Percentage Calculator
Calculate percentages, percentage change, and percentage increase/decrease
Sample Calculations
Common Formulas
Examples
💡 Percentage Calculator Tips
- • Percentage Change: Use for tracking progress over time (sales, growth)
- • Percentage Difference: Use for comparing two separate values
- • Apply Percentage: Great for discounts, tips, tax calculations
- • Negative Results: Indicate decreases or reductions
- • Remember: percentages can exceed 100% (200% = triple the original)
About Percentage Calculations
Percentage calculations are fundamental mathematical operations used in finance, statistics, business analysis, and everyday life. Our calculator handles all common percentage operations with clear explanations and step-by-step solutions.
- Calculate percentage of any number
- Find percentage increase and decrease
- Determine percentage change between values
- Calculate what percentage one number is of another
- Reverse percentage calculations (find original value)
Types of Percentage Calculations
Basic Percentages
- Percentage of a number (25% of 200)
- What percent is X of Y (50 is what % of 200?)
- Finding the whole from percentage (25% = 50, whole = ?)
- Converting fractions to percentages
- Converting decimals to percentages
Change Calculations
- Percentage increase (from 100 to 120 = 20% increase)
- Percentage decrease (from 120 to 100 = 16.67% decrease)
- Percentage change (positive or negative)
- Compound percentage changes
- Percentage difference between values
Advertisement
Frequently Asked Questions
What's the difference between percentage change and percentage difference?
Percentage change measures the change from an original value to a new value. Percentage difference compares two values without assuming one is the "original." Use change for tracking progress, difference for comparing alternatives.
How do I calculate percentage increase vs decrease?
Both use the same formula: ((New Value - Original Value) / Original Value) × 100. If the result is positive, it's an increase. If negative, it's a decrease. The absolute value gives you the magnitude.
Can percentages exceed 100%?
Yes! Percentages can exceed 100%. For example, if something doubles in size, that's a 100% increase. If it triples, that's a 200% increase. There's no upper limit to percentage increases.
How do I work with negative percentages?
Negative percentages typically indicate a decrease or reduction. A -20% change means a 20% decrease. When calculating percentages of negative numbers, the sign is preserved in the result.
Percentage Calculation Examples
Basic Percentage:
Percentage Change:
Sponsored Content
Essential Percentage Formulas
1. Percentage of a Number:
2. What Percentage:
3. Find the Whole:
4. Percentage Change:
5. Percentage Difference:
Real-World Percentage Applications
Financial Applications:
Business Metrics:
Programming Examples
JavaScript Percentage Calculator:
class PercentageCalculator {
// Calculate percentage of a number
static percentageOf(percentage, number) {
if (typeof percentage !== 'number' || typeof number !== 'number') {
throw new Error('Both arguments must be numbers');
}
return (percentage / 100) * number;
}
// Find what percentage one number is of another
static whatPercent(part, whole) {
if (typeof part !== 'number' || typeof whole !== 'number') {
throw new Error('Both arguments must be numbers');
}
if (whole === 0) {
throw new Error('Whole cannot be zero');
}
return (part / whole) * 100;
}
// Find the whole from a percentage and part
static findWhole(part, percentage) {
if (typeof part !== 'number' || typeof percentage !== 'number') {
throw new Error('Both arguments must be numbers');
}
if (percentage === 0) {
throw new Error('Percentage cannot be zero');
}
return part / (percentage / 100);
}
// Calculate percentage change
static percentageChange(oldValue, newValue) {
if (typeof oldValue !== 'number' || typeof newValue !== 'number') {
throw new Error('Both arguments must be numbers');
}
if (oldValue === 0) {
return newValue === 0 ? 0 : Infinity;
}
return ((newValue - oldValue) / oldValue) * 100;
}
// Calculate percentage increase
static percentageIncrease(oldValue, newValue) {
const change = this.percentageChange(oldValue, newValue);
return change > 0 ? change : 0;
}
// Calculate percentage decrease
static percentageDecrease(oldValue, newValue) {
const change = this.percentageChange(oldValue, newValue);
return change < 0 ? Math.abs(change) : 0;
}
// Calculate percentage difference
static percentageDifference(value1, value2) {
if (typeof value1 !== 'number' || typeof value2 !== 'number') {
throw new Error('Both arguments must be numbers');
}
const average = (value1 + value2) / 2;
if (average === 0) {
return 0;
}
return (Math.abs(value1 - value2) / average) * 100;
}
// Apply percentage to a number (add or subtract)
static applyPercentage(number, percentage, operation = 'add') {
if (typeof number !== 'number' || typeof percentage !== 'number') {
throw new Error('Number and percentage must be numbers');
}
const amount = this.percentageOf(percentage, number);
switch (operation.toLowerCase()) {
case 'add':
case '+':
return number + amount;
case 'subtract':
case '-':
return number - amount;
default:
throw new Error('Operation must be "add" or "subtract"');
}
}
// Compound percentage calculation
static compoundPercentage(initialValue, percentage, periods) {
if (typeof initialValue !== 'number' || typeof percentage !== 'number' || typeof periods !== 'number') {
throw new Error('All arguments must be numbers');
}
const rate = 1 + (percentage / 100);
return initialValue * Math.pow(rate, periods);
}
// Format percentage for display
static formatPercentage(value, decimals = 2) {
if (typeof value !== 'number') {
throw new Error('Value must be a number');
}
return value.toFixed(decimals) + '%';
}
}
// Usage examples
console.log(PercentageCalculator.percentageOf(25, 200)); // 50
console.log(PercentageCalculator.whatPercent(50, 200)); // 25
console.log(PercentageCalculator.findWhole(50, 25)); // 200
console.log(PercentageCalculator.percentageChange(100, 125)); // 25
console.log(PercentageCalculator.percentageDifference(100, 120)); // 18.181818181818183
console.log(PercentageCalculator.applyPercentage(100, 20, 'add')); // 120
console.log(PercentageCalculator.compoundPercentage(1000, 5, 3)); // 1157.625
Python Percentage Calculator:
import math
from typing import Union
class PercentageCalculator:
@staticmethod
def percentage_of(percentage: float, number: float) -> float:
"""Calculate percentage of a number"""
return (percentage / 100) * number
@staticmethod
def what_percent(part: float, whole: float) -> float:
"""Find what percentage one number is of another"""
if whole == 0:
raise ValueError("Whole cannot be zero")
return (part / whole) * 100
@staticmethod
def find_whole(part: float, percentage: float) -> float:
"""Find the whole from a percentage and part"""
if percentage == 0:
raise ValueError("Percentage cannot be zero")
return part / (percentage / 100)
@staticmethod
def percentage_change(old_value: float, new_value: float) -> float:
"""Calculate percentage change"""
if old_value == 0:
return float('inf') if new_value != 0 else 0
return ((new_value - old_value) / old_value) * 100
@staticmethod
def percentage_increase(old_value: float, new_value: float) -> float:
"""Calculate percentage increase (positive changes only)"""
change = PercentageCalculator.percentage_change(old_value, new_value)
return max(0, change)
@staticmethod
def percentage_decrease(old_value: float, new_value: float) -> float:
"""Calculate percentage decrease (negative changes only)"""
change = PercentageCalculator.percentage_change(old_value, new_value)
return abs(min(0, change))
@staticmethod
def percentage_difference(value1: float, value2: float) -> float:
"""Calculate percentage difference between two values"""
average = (value1 + value2) / 2
if average == 0:
return 0
return (abs(value1 - value2) / average) * 100
@staticmethod
def apply_percentage(number: float, percentage: float, operation: str = 'add') -> float:
"""Apply percentage to a number (add or subtract)"""
amount = PercentageCalculator.percentage_of(percentage, number)
if operation.lower() in ['add', '+']:
return number + amount
elif operation.lower() in ['subtract', '-']:
return number - amount
else:
raise ValueError("Operation must be 'add' or 'subtract'")
@staticmethod
def compound_percentage(initial_value: float, percentage: float, periods: int) -> float:
"""Calculate compound percentage growth"""
rate = 1 + (percentage / 100)
return initial_value * (rate ** periods)
@staticmethod
def format_percentage(value: float, decimals: int = 2) -> str:
"""Format percentage for display"""
return f"{value:.{decimals}f}%"
@staticmethod
def percentage_breakdown(total: float, *parts: float) -> dict:
"""Calculate what percentage each part is of the total"""
if total == 0:
raise ValueError("Total cannot be zero")
breakdown = {}
for i, part in enumerate(parts):
percentage = (part / total) * 100
breakdown[f'part_{i+1}'] = {
'value': part,
'percentage': percentage,
'formatted': PercentageCalculator.format_percentage(percentage)
}
return breakdown
# Usage examples
if __name__ == "__main__":
calc = PercentageCalculator()
print("25% of 200:", calc.percentage_of(25, 200)) # 50.0
print("50 is what % of 200:", calc.what_percent(50, 200)) # 25.0
print("If 50 is 25%, whole is:", calc.find_whole(50, 25)) # 200.0
print("Change from 100 to 125:", calc.percentage_change(100, 125)) # 25.0
print("Difference between 100 and 120:", calc.percentage_difference(100, 120)) # 18.18
print("Add 20% to 100:", calc.apply_percentage(100, 20, 'add')) # 120.0
print("Compound 5% over 3 periods on 1000:", calc.compound_percentage(1000, 5, 3)) # 1157.625
# Breakdown example
breakdown = calc.percentage_breakdown(1000, 250, 300, 200, 250)
for part, data in breakdown.items():
print(f"{part}: {data['value']} ({data['formatted']})")
Percentage Calculation Best Practices
- Check for Zero Division: Always validate that denominators are not zero
- Handle Edge Cases: Consider negative numbers, infinity, and very large values
- Round Appropriately: Display percentages with reasonable decimal places (usually 2)
- Provide Context: Clearly indicate whether it's increase, decrease, or change
- Use Appropriate Formulas: Choose the right calculation type for your specific use case
- Validate Inputs: Ensure inputs are numeric and within expected ranges
- Consider Precision: Be aware of floating-point arithmetic limitations
Common Use Cases
- Financial analysis and budgeting
- Sales performance tracking
- Grade and score calculations
- Tax and tip calculations
- Discount and markup pricing
- Statistical data analysis
- Progress tracking and KPIs
- Market research and surveys
Advertisement
