Gas mileage is calculated using the number of gallons of gas consumed and the number of miles driven. To find the number of gallons used, fill up your gas tank all the way. Upon the conclusion of your trip, fill up the gas tank again. The number of gallons it took to fill up that second time is the number of gallons used. Divide that number by the number of miles driven on those gallons and you arrive at the miles per gallon or gas mileage. Happy driving!