# Miles Per Gallon (MPG) Calculator

The *Miles Per Gallon (MPG) Calculator* is used to easily compute how many gallons or liters of fuel (diesel
or gasoline) your vehicle had consumed based on a total distance traveled.

## How to Measure Your Fuel Usage

The computation for the MPG is relatively easy because you just have to divide the total travel distance by the gasoline or diesel your vehicle has consumed during your travels.

However, the question of most drivers especially for new ones is that, how can you know how much gasoline you have consumed?

If you take it to consideration, on your dashboard it just shows a gauge how much fuel you have in fuel tank, it's either full, half or near empty. It doesn't indicate an actual gallon or liter.

To combat this issue, you just have to manually do this on your own. To get your total travel distance and total fuel consumption, here's how to do it:

- Step 1
First, as you are idling on a gasoline station to refill your tank, reset your mileage or take note of your current mileage if you can't reset it to zero (0). You can type it on a paper, on your phone even picture it out just have it captured or written (this is the initial reading).

- Step 2
Next, prepare your budget as this works by refilling your tank in full. Because it is really impractical to empty your tank on the road just to get your "Miles Per Gallon".

- Step 3
Then, if your done with your trip or your travels and you decide to refill your tank again on the gasoline station, this time record your odometer (this will be the final reading) and how much fuel you have added.

So, let's talk about the logic. First, fill your tank fully because as explained it's impractical to empty your tank on the road just to do this, it's really a hustle. Then after your next full tank, take note of the added fuel because that represents the total gasoline you have consumed on your trip. Here's a visual representation of this logic.

## How to Use the MPG Calculator

At first glance, these inputs seem reasonable because you'll just have to enter the starting/final odometer reading or distance, gas loaded and gas price. In case you want it to be elaborated more, here's a step by step guide for you:

- Step 1
First, enter the Starting Odometer and Final Odometer on their corresponding input fields but these are optional. The

`Starting Odometer`

marks the initial reading of your odometer before you start your trip and the`Final Odometer`

which is the reading after your trip. And if you are following the fuel tracking logic above, the starting odometer is where you record on your first full tank and the final odometer is where you record your reading on your next full tank. - Step 2
The reason why the

`Starting`

and`Final Odometer`

readings are optional because they only derive the total distance traveled, thus, it will be reflected on the`Distance`

input field. However, you can just override the distance by entering manually the distance traveled. - Step 3
Then, enter the

`Fuel Loaded`

(diesel or gasoline) which represents the fuel you have added to the tank. Again, you can check out the logic above for the measurement of fuel usage. - Step 4
Next, enter the

`Fuel Price`

which represents the price of added gasoline or diesel per liter or gallon. - Step 4
Finally, click on the

`Calculate`

button to get the results which will be displayed on result set marked by "✍️ MPG Results". You can also click on`Clear`

button to remove all data from inputs.