The maths is distance divided by miles per gallon, times the price per gallon. Your real fuel economy varies with speed, load, weather and traffic, so use the figure your car actually achieves on this kind of trip rather than the sticker figure if you know it. The calculator works in miles and US gallons. Nothing you enter leaves this page.
Divide the distance by your car's miles per gallon to get the gallons, then multiply by the price per gallon. A 300-mile trip at 30 mpg with gas at $3.50 uses 10 gallons and costs $35.
At 30 mpg, about 16.7 gallons. Enter your distance and your car's real mpg above for your figure.
The fuel cost divided by the distance — the price of gas divided by your mpg. At $3.50 a gallon and 30 mpg it is about 12 cents a mile for fuel.
Use the economy your car actually gets on this kind of driving if you know it; highway and city figures differ, and the sticker number is a test result, not a promise.