Easily solve for distance, speed, or time using the D = RT formula.
Understanding the Rate Formula (D = RT)
In physics and mathematics, the relationship between distance, rate (speed), and time is one of the most fundamental concepts. Whether you are planning a road trip, calculating a runner's pace, or determining how long it takes for a signal to travel, you use the standard rate equation.
The Basic Equations
- Distance = Rate × Time (d = r ⋅ t)
- Rate = Distance ÷ Time (r = d / t)
- Time = Distance ÷ Rate (t = d / r)
How to Solve Rate Problems
To solve any rate problem, you must ensure that your units are consistent. For example, if your speed is in miles per hour (mph), your time must be in hours to calculate the distance in miles. Our calculator handles basic unit logic, but it is always good practice to double-check your metrics.
Practical Examples
Example 1: Finding Distance
A car travels at a constant speed of 65 mph for 3.5 hours. How far did it go?
Calculation: 65 × 3.5 = 227.5 miles.
Example 2: Finding Speed (Rate)
A cyclist completes a 40-kilometer course in 2 hours. What was their average speed?
Calculation: 40 / 2 = 20 km/h.
Frequently Asked Questions
What is "Rate"?
Rate is the ratio of two different units, usually distance over time (like meters per second or miles per hour).
What if the speed changes?
This calculator solves for average rate. If speed varies, the result represents the constant speed required to cover the same distance in the same amount of time.
function updateFields() {
var solveFor = document.getElementById("solveFor").value;
var label1 = document.getElementById("label1");
var label2 = document.getElementById("label2");
var unit1 = document.getElementById("unit1");
var unit2 = document.getElementById("unit2");
var val1 = document.getElementById("val1");
var val2 = document.getElementById("val2");
// Reset Result
document.getElementById("rateResult").style.display = "none";
val1.value = "";
val2.value = "";
if (solveFor === "distance") {
label1.innerHTML = "Rate (Speed)";
label2.innerHTML = "Time";
unit1.innerHTML = 'mphkm/hm/s';
unit2.innerHTML = 'HoursMinutesSeconds';
} else if (solveFor === "rate") {
label1.innerHTML = "Distance";
label2.innerHTML = "Time";
unit1.innerHTML = 'MilesKilometersMeters';
unit2.innerHTML = 'HoursMinutesSeconds';
} else if (solveFor === "time") {
label1.innerHTML = "Distance";
label2.innerHTML = "Rate (Speed)";
unit1.innerHTML = 'MilesKilometersMeters';
unit2.innerHTML = 'mphkm/hm/s';
}
}
function calculateRate() {
var solveFor = document.getElementById("solveFor").value;
var v1 = parseFloat(document.getElementById("val1").value);
var v2 = parseFloat(document.getElementById("val2").value);
var u1 = document.getElementById("unit1").value;
var u2 = document.getElementById("unit2").value;
var resultDiv = document.getElementById("rateResult");
var output = document.getElementById("resultOutput");
var steps = document.getElementById("calculationSteps");
if (isNaN(v1) || isNaN(v2) || v1 <= 0 || v2 <= 0) {
alert("Please enter valid positive numbers for both fields.");
return;
}
var result = 0;
var unitLabel = "";
var mathText = "";
if (solveFor === "distance") {
// Time normalization (to hours or seconds based on rate unit)
var timeInMainUnit = v2;
if (u1 === "mph" || u1 === "kph") {
if (u2 === "minutes") timeInMainUnit = v2 / 60;
if (u2 === "seconds") timeInMainUnit = v2 / 3600;
} else if (u1 === "mps") {
if (u2 === "hours") timeInMainUnit = v2 * 3600;
if (u2 === "minutes") timeInMainUnit = v2 * 60;
}
result = v1 * timeInMainUnit;
unitLabel = (u1 === "mph") ? "Miles" : (u1 === "kph" ? "Kilometers" : "Meters");
mathText = "Distance = " + v1 + " (" + u1 + ") × " + timeInMainUnit.toFixed(4) + " (converted " + u2 + ")";
} else if (solveFor === "rate") {
// Time normalization to hours for mph/kph
var timeInHours = v2;
if (u2 === "minutes") timeInHours = v2 / 60;
if (u2 === "seconds") timeInHours = v2 / 3600;
result = v1 / timeInHours;
unitLabel = (u1 === "miles") ? "mph" : (u1 === "km" ? "km/h" : "units/hr");
if (u1 === "meters" && u2 === "seconds") {
result = v1 / v2;
unitLabel = "m/s";
}
mathText = "Rate = " + v1 + " (" + u1 + ") / " + timeInHours.toFixed(4) + " (converted " + u2 + ")";
} else if (solveFor === "time") {
// Standard d/r
result = v1 / v2;
unitLabel = (u2 === "mph" || u2 === "kph") ? "Hours" : "Seconds";
mathText = "Time = " + v1 + " (" + u1 + ") / " + v2 + " (" + u2 + ")";
}
output.innerHTML = "Result: " + result.toLocaleString(undefined, {maximumFractionDigits: 2}) + " " + unitLabel;
steps.innerHTML = mathText;
resultDiv.style.display = "block";
}