Calculate the Part, Rate, or Whole (Base) instantly
Find the Percentage (Part)
Find the Rate (Percentage %)
Find the Base (Whole Value)
Calculated Result:
Understanding the Percent-Rate-Base Relationship
In mathematics and business logic, most percentage problems involve three core components. Understanding how these interact allows you to solve for any missing variable using the basic formula: Percentage (Part) = Rate × Base.
Base (B): This represents the "Whole" or the total amount (e.g., the original price of an item or the total population).
Rate (R): This is the ratio expressed as a percentage (e.g., 15%, 0.5%, or 120%). In calculations, we usually convert this to a decimal (15% = 0.15).
Percentage or Part (P): This is the "Portion" of the base that corresponds to the rate.
Practical Examples
Example 1: Finding the Part
If you have a 15% discount on a 200 unit item, what is the discount amount? Formula: P = R × B → (15 / 100) × 200 = 30.
Example 2: Finding the Rate
If 25 students out of a class of 100 are present, what is the attendance rate? Formula: R = (P / B) × 100 → (25 / 100) × 100 = 25%.
Example 3: Finding the Base
If 10 is 20% of a number, what is that number? Formula: B = P / (R / 100) → 10 / 0.20 = 50.
function updateInputs() {
var mode = document.getElementById('calcMode').value;
var label1 = document.getElementById('labelVal1');
var label2 = document.getElementById('labelVal2');
var input1 = document.getElementById('inputVal1');
var input2 = document.getElementById('inputVal2');
var resultWrapper = document.getElementById('resultWrapper');
resultWrapper.style.display = 'none';
input1.value = ";
input2.value = ";
if (mode === 'part') {
label1.innerHTML = 'Rate (%)';
label2.innerHTML = 'Base (Whole)';
input1.placeholder = 'e.g. 15';
input2.placeholder = 'e.g. 200';
} else if (mode === 'rate') {
label1.innerHTML = 'Percentage (Part)';
label2.innerHTML = 'Base (Whole)';
input1.placeholder = 'e.g. 30';
input2.placeholder = 'e.g. 200';
} else if (mode === 'base') {
label1.innerHTML = 'Percentage (Part)';
label2.innerHTML = 'Rate (%)';
input1.placeholder = 'e.g. 30';
input2.placeholder = 'e.g. 15';
}
}
function calculatePRB() {
var mode = document.getElementById('calcMode').value;
var val1 = parseFloat(document.getElementById('inputVal1').value);
var val2 = parseFloat(document.getElementById('inputVal2').value);
var resDiv = document.getElementById('resultValue');
var formDiv = document.getElementById('resultFormula');
var wrapper = document.getElementById('resultWrapper');
var finalResult = 0;
if (isNaN(val1) || isNaN(val2)) {
alert('Please enter valid numeric values in both fields.');
return;
}
if (mode === 'part') {
// P = (R/100) * B
finalResult = (val1 / 100) * val2;
resDiv.innerHTML = finalResult.toLocaleString(undefined, {maximumFractionDigits: 4});
formDiv.innerHTML = 'Formula: (' + val1 + ' / 100) × ' + val2 + ' = ' + finalResult;
} else if (mode === 'rate') {
// R = (P / B) * 100
if (val2 === 0) {
alert('Base value cannot be zero.');
return;
}
finalResult = (val1 / val2) * 100;
resDiv.innerHTML = finalResult.toLocaleString(undefined, {maximumFractionDigits: 4}) + '%';
formDiv.innerHTML = 'Formula: (' + val1 + ' / ' + val2 + ') × 100 = ' + finalResult + '%';
} else if (mode === 'base') {
// B = P / (R / 100)
if (val2 === 0) {
alert('Rate cannot be zero when calculating the base.');
return;
}
finalResult = val1 / (val2 / 100);
resDiv.innerHTML = finalResult.toLocaleString(undefined, {maximumFractionDigits: 4});
formDiv.innerHTML = 'Formula: ' + val1 + ' / (' + val2 + ' / 100) = ' + finalResult;
}
wrapper.style.display = 'block';
}
// Initialize labels on load
updateInputs();