This is an easy calculation for me. I have logged everything I've spent on this car from the day I bought it, including tolls, car washes, taxes, tags, repairs and insurance. From March 2008 until today it has cost me $0.51 per mile. If I leave out vehicle cost depreciation it was $0.28 per mile.
Fuel comprised $0.133 of the cost per mile, or ~27%. For pure
operating costs (excluding purchase price/depreciation) fuel was 47% of my cost.
By buying a used car I saved the cost of mining the minerals to make it, smelting the steel, assembly, and shipping a new car.
The tool I use is online at
www.spritmonitor.de/en/ that calculates all this for me. It also tells me my per-tank and total fuel mileage, emitted CO2, and my average fuel cost per mile (13.27 cents).