The formula to calculate fuel consumption is as follows: Take the total mileage driven and divide it by the number of gallons of fuel consumed during the trip. This number is the mile per gallon of the vehicle. For example, driving 900 miles and consuming 30 gallons of fuel would lead to a calculation of 30 miles per gallon.