Consumption Rate Calculator
What is Consumption Rate?
Consumption rate, often referred to as fuel efficiency or fuel consumption, is a measure of how much fuel an engine or vehicle uses to travel a certain distance. It's a crucial metric for understanding the efficiency of transportation, whether it's a car, truck, motorcycle, or even an aircraft. A lower consumption rate indicates better fuel efficiency, meaning the vehicle can travel further on the same amount of fuel, or use less fuel for the same distance. This translates to cost savings and reduced environmental impact.
How to Calculate Consumption Rate
The formula for calculating consumption rate is straightforward:
Consumption Rate = (Fuel Consumed / Distance Traveled) * 100
The result is typically expressed in liters per 100 kilometers (L/100km). This is the standard unit used in many countries to compare the fuel efficiency of vehicles.
Example Calculation:
Let's say a car travels 500 kilometers and consumes 40 liters of fuel during that trip.
Consumption Rate = (40 liters / 500 km) * 100
Consumption Rate = 0.08 * 100
Consumption Rate = 8 L/100km
This means the car consumes 8 liters of fuel for every 100 kilometers it travels.
function calculateConsumptionRate() {
var distance = parseFloat(document.getElementById("distanceTraveled").value);
var fuel = parseFloat(document.getElementById("fuelConsumed").value);
var resultDiv = document.getElementById("result");
if (isNaN(distance) || isNaN(fuel) || distance <= 0 || fuel < 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for distance and fuel consumed.";
return;
}
var consumptionRate = (fuel / distance) * 100;
resultDiv.innerHTML = "
Your Consumption Rate:
" +
"
" + consumptionRate.toFixed(2) + " L/100km";
}
.calculator-wrapper {
font-family: sans-serif;
max-width: 700px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.calculator-wrapper h2, .calculator-wrapper h3 {
text-align: center;
color: #333;
margin-bottom: 20px;
}
.calculator-inputs {
display: flex;
flex-direction: column;
gap: 15px;
margin-bottom: 20px;
}
.input-group {
display: flex;
align-items: center;
gap: 10px;
}
.input-group label {
flex: 1;
font-weight: bold;
color: #555;
}
.input-group input[type="number"] {
flex: 2;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1rem;
}
.calculator-inputs button {
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 1.1rem;
cursor: pointer;
transition: background-color 0.3s ease;
}
.calculator-inputs button:hover {
background-color: #0056b3;
}
.calculator-result {
background-color: #e9ecef;
padding: 15px;
border-radius: 4px;
text-align: center;
margin-top: 20px;
border: 1px solid #ced4da;
}
.calculator-result h3 {
margin-top: 0;
margin-bottom: 10px;
color: #007bff;
}
.calculator-result p {
font-size: 1.2rem;
font-weight: bold;
color: #333;
}
.calculator-explanation {
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #eee;
color: #444;
line-height: 1.6;
}
.calculator-explanation h3, .calculator-explanation h4 {
color: #333;
margin-bottom: 10px;
}
.calculator-explanation p {
margin-bottom: 15px;
}
.calculator-explanation strong {
color: #007bff;
}