Enter three values to find the missing fourth, or enter all four to check equivalence.
Ratio 1
:
Ratio 2
:
What are Equivalent Ratios?
Equivalent ratios are two or more ratios that express the same relationship between numbers. Even though the numbers in the ratios may be different, their relative values are identical. For instance, the ratio 1:2 is equivalent to 2:4, 3:6, and 50:100. In all these cases, the second number is exactly twice the first number.
The Math Behind Proportions
A statement that two ratios are equal is called a proportion. We mathematically express this as:
A / B = C / D
To determine if two ratios are equivalent or to find a missing value, we use the Cross-Multiplication Method. This rule states that the product of the means equals the product of the extremes:
A × D = B × C
Example: Solving for a Missing Value
If you have the ratio 4:5 and you want to know what the equivalent value is when the first term is 12 (12:x), you set up the equation:
4 / 5 = 12 / x
4 × x = 5 × 12
4x = 60
x = 15. Therefore, 4:5 is equivalent to 12:15.
Real-World Applications
Cooking: If a recipe for 2 people requires 3 cups of flour, how much do you need for 6 people? (Ratio 2:3 = 6:x).
Map Reading: If 1 inch on a map represents 50 miles, how many miles is 3.5 inches? (Ratio 1:50 = 3.5:x).
Finance: Comparing unit prices at the grocery store to find the best deal.
Photography: Maintaining aspect ratios (like 16:9) when resizing images or video.
How to use this Calculator
This tool serves two purposes:
Find a Missing Term: Enter any three numbers in the boxes (A, B, C, or D) and leave one empty. Click calculate to solve for the missing variable.
Verification: Enter all four numbers to see if the two ratios are truly equivalent. The calculator will perform the cross-multiplication check for you.
function calculateRatio() {
var a = document.getElementById('valA').value;
var b = document.getElementById('valB').value;
var c = document.getElementById('valC').value;
var d = document.getElementById('valD').value;
var resultDiv = document.getElementById('ratio-result');
var numA = parseFloat(a);
var numB = parseFloat(b);
var numC = parseFloat(c);
var numD = parseFloat(d);
var filledCount = 0;
if (a !== "") filledCount++;
if (b !== "") filledCount++;
if (c !== "") filledCount++;
if (d !== "") filledCount++;
resultDiv.style.display = "block";
resultDiv.className = "";
if (filledCount === 4) {
// Checking equivalence
if (numB === 0 || numD === 0) {
resultDiv.innerHTML = "Error: Division by zero is not allowed in ratios.";
resultDiv.classList.add("error");
return;
}
var ratio1 = numA / numB;
var ratio2 = numC / numD;
// Using cross multiplication for precision to avoid floating point issues
if (Math.abs((numA * numD) – (numB * numC)) < 0.000001) {
resultDiv.innerHTML = "Yes! These ratios are equivalent. (" + numA + ":" + numB + " = " + numC + ":" + numD + ")";
resultDiv.classList.add("success");
} else {
resultDiv.innerHTML = "No. These ratios are not equivalent.";
resultDiv.classList.add("error");
}
} else if (filledCount === 3) {
// Solving for missing value
var missingVal = 0;
var label = "";
if (a === "") {
if (numD === 0) { resultDiv.innerHTML = "Cannot calculate: D is zero."; resultDiv.classList.add("error"); return; }
missingVal = (numB * numC) / numD;
document.getElementById('valA').value = missingVal.toFixed(4).replace(/\.?0+$/, "");
label = "A";
} else if (b === "") {
if (numC === 0) { resultDiv.innerHTML = "Cannot calculate: C is zero."; resultDiv.classList.add("error"); return; }
missingVal = (numA * numD) / numC;
document.getElementById('valB').value = missingVal.toFixed(4).replace(/\.?0+$/, "");
label = "B";
} else if (c === "") {
if (numB === 0) { resultDiv.innerHTML = "Cannot calculate: B is zero."; resultDiv.classList.add("error"); return; }
missingVal = (numA * numD) / numB;
document.getElementById('valC').value = missingVal.toFixed(4).replace(/\.?0+$/, "");
label = "C";
} else if (d === "") {
if (numA === 0) { resultDiv.innerHTML = "Cannot calculate: A is zero."; resultDiv.classList.add("error"); return; }
missingVal = (numB * numC) / numA;
document.getElementById('valD').value = missingVal.toFixed(4).replace(/\.?0+$/, "");
label = "D";
}
resultDiv.innerHTML = "Solved! The missing value (" + label + ") is " + missingVal.toFixed(4).replace(/\.?0+$/, "") + ".";
resultDiv.classList.add("info");
} else {
resultDiv.innerHTML = "Please enter exactly 3 values to solve for the 4th, or enter all 4 to compare.";
resultDiv.classList.add("error");
}
}
function resetRatioCalc() {
document.getElementById('valA').value = "";
document.getElementById('valB').value = "";
document.getElementById('valC').value = "";
document.getElementById('valD').value = "";
var resultDiv = document.getElementById('ratio-result');
resultDiv.style.display = "none";
resultDiv.innerHTML = "";
}