Convert speed, flow, density, and price rates instantly.
Speed (Distance / Time)
Flow Rate (Volume / Time)
Unit Price (Currency / Mass)
Unit Price (Currency / Volume)
Density (Mass / Volume)
per
per
What is a Unit Rate?
A unit rate is a ratio that compares two measurements with different units, where the second measurement (the denominator) is reduced to one. Common examples of unit rates used in daily life and physics include speed (miles per hour), unit price (dollars per pound), and flow rate (gallons per minute).
This Convert Unit Rate Calculator helps you translate these rates from one system of measurement to another using a process often called "Dimensional Analysis" or the "Factor-Label Method."
How to Convert Unit Rates
Converting a unit rate involves converting the numerator (top number) and the denominator (bottom number) simultaneously. The formula generally follows this logic:
Step 1: Identify the conversion factor for the numerator (e.g., converting miles to feet).
Step 2: Identify the conversion factor for the denominator (e.g., converting hours to seconds).
Step 3: Multiply the original value by the numerator factor and divide by the denominator factor.
For example, to convert 60 miles per hour to feet per second:
Our calculator supports various categories to help you with physics problems, shopping comparisons, or engineering calculations:
Speed & Velocity
Used to measure how fast an object moves. Common conversions include Kilometers per Hour (km/h) to Meters per Second (m/s), or Miles per Hour (mph) to Knots.
Flow Rate
Critical in plumbing and fluid dynamics, measuring the volume of fluid moving over time. Typical conversions are Gallons per Minute (GPM) to Liters per Hour (L/hr).
Unit Price
Essential for smart shopping. By converting prices to a common unit (like Price per Ounce or Price per Kilogram), you can determine the best value between different package sizes.
Density
Density is the mass per unit volume of a substance. Chemists and engineers often convert from grams per cubic centimeter (g/cm³) to kilograms per cubic meter (kg/m³).
// Data Structure for Units and Conversion Factors (Base units: Meter, Second, Kilogram, Liter, Dollar)
var unitData = {
distance: {
'm': { name: 'Meters (m)', factor: 1 },
'km': { name: 'Kilometers (km)', factor: 1000 },
'cm': { name: 'Centimeters (cm)', factor: 0.01 },
'mm': { name: 'Millimeters (mm)', factor: 0.001 },
'mi': { name: 'Miles (mi)', factor: 1609.344 },
'yd': { name: 'Yards (yd)', factor: 0.9144 },
'ft': { name: 'Feet (ft)', factor: 0.3048 },
'in': { name: 'Inches (in)', factor: 0.0254 }
},
time: {
's': { name: 'Seconds (s)', factor: 1 },
'min': { name: 'Minutes (min)', factor: 60 },
'hr': { name: 'Hours (hr)', factor: 3600 },
'day': { name: 'Days', factor: 86400 },
'ms': { name: 'Milliseconds (ms)', factor: 0.001 }
},
mass: {
'kg': { name: 'Kilograms (kg)', factor: 1 },
'g': { name: 'Grams (g)', factor: 0.001 },
'mg': { name: 'Milligrams (mg)', factor: 0.000001 },
'lb': { name: 'Pounds (lb)', factor: 0.45359237 },
'oz': { name: 'Ounces (oz)', factor: 0.0283495 }
},
volume: {
'l': { name: 'Liters (L)', factor: 1 },
'ml': { name: 'Milliliters (mL)', factor: 0.001 },
'gal': { name: 'Gallons (US)', factor: 3.78541 },
'qt': { name: 'Quarts (US)', factor: 0.946353 },
'pt': { name: 'Pints (US)', factor: 0.473176 },
'floz': { name: 'Fluid Oz (US)', factor: 0.0295735 },
'm3': { name: 'Cubic Meters (m³)', factor: 1000 },
'cm3': { name: 'Cubic Cm (cm³)', factor: 0.001 }
},
currency: {
'usd': { name: 'Currency (Standard)', factor: 1 },
'cent': { name: 'Cents/Pennies', factor: 0.01 }
}
};
// Configuration mapping categories to unit types
var categories = {
speed: { num: 'distance', den: 'time' },
flow: { num: 'volume', den: 'time' },
price_mass: { num: 'currency', den: 'mass' },
price_vol: { num: 'currency', den: 'volume' },
density: { num: 'mass', den: 'volume' }
};
function initCalculator() {
updateUnits();
}
function populateSelect(selectId, unitType) {
var select = document.getElementById(selectId);
select.innerHTML = "; // Clear existing
var units = unitData[unitType];
for (var key in units) {
if (units.hasOwnProperty(key)) {
var option = document.createElement('option');
option.value = key;
option.text = units[key].name;
option.setAttribute('data-factor', units[key].factor);
select.appendChild(option);
}
}
}
function updateUnits() {
var catSelect = document.getElementById('categorySelect');
var selectedCat = catSelect.value;
var config = categories[selectedCat];
// Populate all 4 dropdowns based on category configuration
populateSelect('fromNum', config.num);
populateSelect('toNum', config.num);
populateSelect('fromDenom', config.den);
populateSelect('toDenom', config.den);
// Set reasonable defaults for common scenarios
if (selectedCat === 'speed') {
document.getElementById('fromNum').value = 'mi';
document.getElementById('fromDenom').value = 'hr';
document.getElementById('toNum').value = 'ft';
document.getElementById('toDenom').value = 's';
} else if (selectedCat === 'price_mass') {
document.getElementById('fromNum').value = 'usd';
document.getElementById('fromDenom').value = 'lb';
document.getElementById('toNum').value = 'usd';
document.getElementById('toDenom').value = 'kg';
}
}
function calculateRate() {
var valInput = document.getElementById('inputValue').value;
var val = parseFloat(valInput);
if (isNaN(val)) {
alert("Please enter a valid numeric rate value.");
return;
}
// Get selected options and categories
var catSelect = document.getElementById('categorySelect').value;
var config = categories[catSelect];
var fromNumKey = document.getElementById('fromNum').value;
var fromDenomKey = document.getElementById('fromDenom').value;
var toNumKey = document.getElementById('toNum').value;
var toDenomKey = document.getElementById('toDenom').value;
// Retrieve factors
var fromNumFactor = unitData[config.num][fromNumKey].factor;
var toNumFactor = unitData[config.num][toNumKey].factor;
var fromDenomFactor = unitData[config.den][fromDenomKey].factor;
var toDenomFactor = unitData[config.den][toDenomKey].factor;
// Logic:
// 1. Convert Input Numerator to Base Numerator (Input * FromNumFactor)
// 2. Convert Base Numerator to Target Numerator (BaseNum / ToNumFactor)
// 3. Convert Input Denominator to Base Denominator (1 * FromDenomFactor)
// 4. Convert Base Denominator to Target Denominator (BaseDenom / ToDenomFactor)
// Math Combined: Result = Value * (FromNumFactor / ToNumFactor) / (FromDenomFactor / ToDenomFactor)
var numRatio = fromNumFactor / toNumFactor;
var denRatio = fromDenomFactor / toDenomFactor;
var totalFactor = numRatio / denRatio;
var result = val * totalFactor;
// Formatting output
var formattedResult = result 10000 ? result.toExponential(4) : parseFloat(result.toFixed(4));
// Get labels for display
var toNumLabel = unitData[config.num][toNumKey].name.split('(')[0].trim();
var toDenomLabel = unitData[config.den][toDenomKey].name.split('(')[0].trim();
// Update UI
document.getElementById('resultBox').style.display = 'block';
document.getElementById('finalResult').innerHTML = formattedResult + " " + toNumKey + "/" + toDenomKey + "";
document.getElementById('resultDetail').innerHTML = "Converted from " + val + " " + fromNumKey + "/" + fromDenomKey + "";
// Show math steps for educational value
var stepHtml = "Conversion Logic:";
stepHtml += val + " × (" + fromNumFactor + " / " + toNumFactor + ") ÷ (" + fromDenomFactor + " / " + toDenomFactor + ")";
stepHtml += "= " + val + " × " + numRatio.toFixed(4) + " ÷ " + denRatio.toFixed(4) + "";
stepHtml += "= " + formattedResult;
document.getElementById('mathSteps').innerHTML = stepHtml;
}