01 Government Data Sources

True Driving Cost uses exclusively official U.S. government data. No third-party data, industry models, proprietary databases, or non-government estimates are used in any calculation. The sole data source is:

FuelEconomy.gov REST API, maintained jointly by the U.S. Department of Energy (DOE), Office of Energy Efficiency & Renewable Energy, and the U.S. Environmental Protection Agency (EPA).

All API requests are made client-side in real time. No vehicle data is cached, stored, or modified by True Driving Cost.

02 API Fields Used

The following fields are retrieved from the FuelEconomy.gov /vehicle/{id} endpoint for each selected vehicle:

FieldDescriptionUsed For
city08EPA city fuel economy (MPG)Fuel cost calculation
highway08EPA highway fuel economy (MPG)Fuel cost calculation
comb08EPA combined fuel economy (MPG)Vehicle summary display
cityA08City fuel economy, alternate fuel (MPGe)EV/PHEV display
highwayA08Highway fuel economy, alternate fuel (MPGe)EV/PHEV display
cityEElectricity consumption (kWh/100mi)EV/PHEV cost calculation
fuelTypePrimary fuel typeFuel price matching
atvTypeAlternative vehicle type (EV, PHEV, etc.)Vehicle classification
co2TailpipeGpmCO₂ tailpipe emissions (g/mi)Emissions display
feScoreEPA fuel economy score (1 to 10)Score ring visualization
ghgScoreEPA greenhouse gas rating (1 to 10)Score ring visualization
fuelCost08EPA estimated annual fuel cost ($)EPA comparison
youSaveSpend5-year savings vs average vehicle ($)EPA comparison
barrels08Annual petroleum consumption (barrels)Petroleum metric
rangeAEPA-rated electric range (mi)PHEV split calculation
rangeTotal range (mi)Range per fill metric
hlv, hpvFuel tank volume (gal)Fill-up count estimate
displEngine displacement (L)Vehicle summary
cylindersNumber of cylindersVehicle summary
tranyTransmission typeVehicle summary
driveDrivetrain (FWD, AWD, etc.)Vehicle summary
VClassEPA vehicle classContext

Fuel prices are retrieved from the /fuelprices endpoint:

FieldDescription
regularRegular gasoline price ($/gal)
midgradeMidgrade gasoline price ($/gal)
premiumPremium gasoline price ($/gal)
dieselDiesel price ($/gal)
e85E85 ethanol price ($/gal)
cngCompressed natural gas ($/GGE)
electricElectricity price ($/kWh)

03 Fuel Cost Calculation

Conventional Vehicles (Gasoline, Diesel, E85, CNG)

Fuel cost is computed using EPA city and highway fuel economy ratings, weighted by the user's specified city/highway driving mix using the EPA harmonic mean formula:

Step 1: Combined MPG (harmonic weighted mean) Combined MPG = 1 / (mix / cityMPG + (1 - mix) / hwyMPG)
Step 2: Annual fuel cost Annual Cost = (miles per year / Combined MPG) × fuel price per gallon
Step 3: Total fuel cost Total Cost = Annual Cost × ownership years

The harmonic mean is used (rather than arithmetic mean) because fuel economy in MPG is a rate (miles per gallon). The harmonic mean correctly weights the proportions of city and highway driving. This is the same formula used by the EPA to calculate combined fuel economy on vehicle window stickers.

Why harmonic mean? A vehicle rated 20 MPG city / 40 MPG highway driven 50/50 achieves 26.7 MPG combined (harmonic), not 30 MPG (arithmetic). The harmonic mean accounts for the fact that lower-efficiency driving (city) consumes disproportionately more fuel per mile.

04 Electric & Plug-in Hybrid Vehicles

Battery Electric Vehicles (BEVs)

For pure electric vehicles (where atvType = "EV" and no plug-in hybrid indicator), fuel cost is calculated using the EPA electricity consumption rating:

BEV annual cost Annual Cost = miles per year × (cityE / 100) × electricity price per kWh

Where cityE is the EPA-rated electricity consumption in kWh per 100 miles. The default electricity rate is sourced from the FuelEconomy.gov fuel prices API. Users can override this with their local rate.

Plug-in Hybrid Electric Vehicles (PHEVs)

For PHEVs, annual mileage is split between electric and gasoline operation based on the EPA-rated electric range:

PHEV electric fraction Electric Fraction = EPA electric range / total range
PHEV annual cost (blended) Annual Cost = (electric miles × kWh/100mi / 100 × elec rate) + (gas miles / Combined MPG × gas price)

If EPA electric range data is unavailable for a PHEV, the calculator falls back to gasoline-only operation using the conventional MPG ratings.

05 Fuel Price Matching

Each vehicle's fuelType field determines which fuel price is applied. The matching logic:

fuelType ContainsPrice Used
"Premium"Premium gasoline
"Diesel"Diesel
"Midgrade"Midgrade gasoline
"E85"E85 ethanol
"CNG" or "Natural"Compressed natural gas
"LPG" or "Propane"LPG/propane
All other gasolineRegular gasoline (default)

Fuel prices are fetched once per session from the FuelEconomy.gov API. If the API is unavailable, conservative fallback prices are used. Users can override the fuel price via the parameter adjustment interface.

06 User Parameters & Validation

Users provide three parameters that shape the analysis:

ParameterRangeDefaultValidation
Ownership Period1 to 30 years5 yearsClamped to valid range
Annual Mileage100 to 500,000 mi/yr12,000 mi/yrClamped to valid range
City Driving Mix0% to 100%55%Clamped to valid range

Additional override parameters (accessible via the results interface):

OverrideRangeDefault
Fuel price (per gallon)$0.01 to $25.00EPA current price
Electricity rate (per kWh)$0.01 to $2.00EPA current rate

All inputs are validated with a clamp(value, min, max) function at every entry point (dropdown selection, popover input, and programmatic update) to prevent invalid calculations.

07 Visualizations

All charts are rendered client-side on HTML5 canvas with devicePixelRatio scaling for crisp rendering on high-DPI displays. No external charting libraries are used.

Fig. 1: Radial Cost Timeline

A polar visualization where each year of ownership is represented as a radial segment (petal). Segment size is proportional to that year's fuel cost. A cumulative cost spiral grows outward from the center, showing total cost accumulation. The center hub displays the total cost. Color progresses from teal to blue across the ownership period. Reference rings and milestone diamonds mark 25%, 50%, and 75% cost thresholds.

Fig. 2: Driving Mix Sensitivity Curve

A continuous curve plotting total fuel cost at every city/highway driving mix from 0% city (all highway) to 100% city. Computed by recalculating total fuel cost at 2% intervals across the full mix range. The user's selected mix point is highlighted with a diamond marker. Best and worst cost points are labeled. A multi-pass label collision avoidance algorithm prevents text overlap.

Fig. 3: Fuel Price Scenario Fan Chart

Four cumulative cost curves showing how total fuel cost varies under different fuel price assumptions:

The shaded fan regions between curves illustrate the compounding effect of fuel price uncertainty over the ownership period. End labels use collision avoidance to prevent overlap.

Fig. 4: Efficiency Gauge

A horizontal gauge showing the vehicle's city MPG, highway MPG, and effective combined MPG at the user's driving mix. The gauge track spans from 75% of the lower rating to 125% of the higher rating. An active region highlights the operating range. The effective MPG marker shows where the vehicle operates at the selected driving mix.

08 EPA Scores & Ratings

Three EPA ratings are displayed directly from the API with no modification:

Scores of −1 (EPA's code for "not rated") are treated as unavailable and displayed as "--".

Score labels are assigned as follows:

Score RangeLabel
8 to 10Excellent
6 to 7Good
4 to 5Average
1 to 3Below Average

09 Derived Metrics

The following metrics are derived from the computed fuel cost data using standard arithmetic:

MetricFormula
Cost per mileTotal cost / total miles
Cost per monthTotal cost / (years × 12)
Cost per dayTotal cost / (years × 365)
Cost per yearTotal cost / years
Cost per 100 miles(Total cost / total miles) × 100
Effective MPG/MPGeHarmonic mean of city/hwy at user's mix
Total fuel consumedTotal miles / effective MPG (gallons) or total miles × kWh/100mi / 100 (kWh)
Total CO₂CO₂ g/mi × total miles / 1,000,000 (metric tons)
Fill-ups / chargesTotal miles / (effective MPG × tank size) or total miles / electric range
Range per fillEffective MPG × tank size (gas) or EPA range (EV)

10 EPA Comparison Data

Two EPA comparison fields are available for context:

11 What Is Not Included

This calculator estimates fuel and electricity costs only. The following vehicle ownership costs are not included because no per-vehicle U.S. government data source exists for them:

IRS Standard Mileage Rate. The IRS publishes an annual standard mileage rate ($0.70/mile for 2025) that covers fuel, depreciation, insurance, and maintenance as a bundled figure. This rate is designed for tax deduction purposes and is not a per-vehicle estimate. It is referenced for context only.

12 Limitations & Assumptions

Important. All estimates are for informational purposes only. They do not constitute financial, legal, or purchasing advice. Actual fuel costs vary based on individual driving habits, geographic location, vehicle condition, fuel price fluctuations, and many other factors.

Key assumptions and limitations:

13 Data Freshness

Vehicle data and fuel prices are retrieved from FuelEconomy.gov in real time with each calculation. There is no local caching of vehicle data. The EPA database is updated as new model years are added and as fuel prices change. Vehicle data in the EPA database covers model years 1984 through the current year.

This site is built with AI.