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).
- Vehicle data: fueleconomy.gov/feg/ws/index.shtml
- Fuel prices: fueleconomy.gov/ws/rest/fuelprices
- EPA fuel economy program: epa.gov/fuel-economy
- EPA Green Vehicles: epa.gov/greenvehicles
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:
| Field | Description | Used For |
|---|---|---|
city08 | EPA city fuel economy (MPG) | Fuel cost calculation |
highway08 | EPA highway fuel economy (MPG) | Fuel cost calculation |
comb08 | EPA combined fuel economy (MPG) | Vehicle summary display |
cityA08 | City fuel economy, alternate fuel (MPGe) | EV/PHEV display |
highwayA08 | Highway fuel economy, alternate fuel (MPGe) | EV/PHEV display |
cityE | Electricity consumption (kWh/100mi) | EV/PHEV cost calculation |
fuelType | Primary fuel type | Fuel price matching |
atvType | Alternative vehicle type (EV, PHEV, etc.) | Vehicle classification |
co2TailpipeGpm | CO₂ tailpipe emissions (g/mi) | Emissions display |
feScore | EPA fuel economy score (1 to 10) | Score ring visualization |
ghgScore | EPA greenhouse gas rating (1 to 10) | Score ring visualization |
fuelCost08 | EPA estimated annual fuel cost ($) | EPA comparison |
youSaveSpend | 5-year savings vs average vehicle ($) | EPA comparison |
barrels08 | Annual petroleum consumption (barrels) | Petroleum metric |
rangeA | EPA-rated electric range (mi) | PHEV split calculation |
range | Total range (mi) | Range per fill metric |
hlv, hpv | Fuel tank volume (gal) | Fill-up count estimate |
displ | Engine displacement (L) | Vehicle summary |
cylinders | Number of cylinders | Vehicle summary |
trany | Transmission type | Vehicle summary |
drive | Drivetrain (FWD, AWD, etc.) | Vehicle summary |
VClass | EPA vehicle class | Context |
Fuel prices are retrieved from the /fuelprices endpoint:
| Field | Description |
|---|---|
regular | Regular gasoline price ($/gal) |
midgrade | Midgrade gasoline price ($/gal) |
premium | Premium gasoline price ($/gal) |
diesel | Diesel price ($/gal) |
e85 | E85 ethanol price ($/gal) |
cng | Compressed natural gas ($/GGE) |
electric | Electricity 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:
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.
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:
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:
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 Contains | Price 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 gasoline | Regular 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:
| Parameter | Range | Default | Validation |
|---|---|---|---|
| Ownership Period | 1 to 30 years | 5 years | Clamped to valid range |
| Annual Mileage | 100 to 500,000 mi/yr | 12,000 mi/yr | Clamped to valid range |
| City Driving Mix | 0% to 100% | 55% | Clamped to valid range |
Additional override parameters (accessible via the results interface):
| Override | Range | Default |
|---|---|---|
| Fuel price (per gallon) | $0.01 to $25.00 | EPA current price |
| Electricity rate (per kWh) | $0.01 to $2.00 | EPA 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:
- Low (−25%): Fuel price 25% below current EPA price
- Current: Current EPA price from FuelEconomy.gov
- High (+35%): Fuel price 35% above current
- Spike (+75%): Fuel price 75% above current
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:
- EPA Fuel Economy Score (
feScore): 1 to 10 scale relative to all vehicles. Higher is better. Rendered as an animated score ring. - EPA Greenhouse Gas Rating (
ghgScore): 1 to 10 scale based on CO₂ tailpipe emissions. Higher is better. Rendered as an animated score ring. - CO₂ Tailpipe Emissions (
co2TailpipeGpm): EPA-measured grams per mile. Displayed on a spectrum from 0 g/mi (BEV) through the national average (~400 g/mi per EPA).
Scores of −1 (EPA's code for "not rated") are treated as unavailable and displayed as "--".
Score labels are assigned as follows:
| Score Range | Label |
|---|---|
| 8 to 10 | Excellent |
| 6 to 7 | Good |
| 4 to 5 | Average |
| 1 to 3 | Below Average |
09 Derived Metrics
The following metrics are derived from the computed fuel cost data using standard arithmetic:
| Metric | Formula |
|---|---|
| Cost per mile | Total cost / total miles |
| Cost per month | Total cost / (years × 12) |
| Cost per day | Total cost / (years × 365) |
| Cost per year | Total cost / years |
| Cost per 100 miles | (Total cost / total miles) × 100 |
| Effective MPG/MPGe | Harmonic mean of city/hwy at user's mix |
| Total fuel consumed | Total 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 / charges | Total miles / (effective MPG × tank size) or total miles / electric range |
| Range per fill | Effective MPG × tank size (gas) or EPA range (EV) |
10 EPA Comparison Data
Two EPA comparison fields are available for context:
- EPA Annual Fuel Cost (
fuelCost08): The EPA's own estimate of annual fuel cost for the vehicle, calculated assuming 15,000 miles per year at 55% city / 45% highway driving at current fuel prices. Displayed for comparison alongside the user's customized estimate. - 5-Year Savings vs Average (
youSaveSpend): EPA's estimate of how much the vehicle saves (positive) or costs more (negative) in fuel over 5 years compared to the average new vehicle. Directly from the EPA database.
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:
- Depreciation: No federal agency publishes per-model depreciation curves
- Insurance: Rates are set by private insurers; no per-vehicle government data
- Maintenance & repairs: No per-vehicle government data; varies by use and condition
- Tires: No per-vehicle government data
- Registration & fees: Varies by state; no unified federal source per vehicle
- Financing / interest: Depends on individual credit; no per-vehicle data
- Sales tax: Varies by state and locality
- Parking & tolls: Varies by geography and individual usage
12 Limitations & Assumptions
Key assumptions and limitations:
- Constant fuel price. The model applies the current EPA fuel price uniformly across the entire ownership period. No inflation modeling, fuel price forecasting, or future price speculation is applied. The fuel price scenario fan chart illustrates sensitivity to price changes but does not predict prices.
- EPA test conditions. Fuel economy ratings are measured under EPA laboratory test conditions. Real-world fuel economy varies based on driving style, speed, weather, terrain, cargo, tire pressure, and vehicle condition. The EPA estimates real-world fuel economy is typically 10 to 20% lower than lab results for some vehicles.
- Constant annual mileage. Annual mileage is assumed constant across all years of ownership.
- No vehicle degradation. Fuel economy is assumed constant; no battery degradation (for EVs/PHEVs) or engine efficiency loss is modeled.
- National fuel prices. Fuel prices from FuelEconomy.gov are national averages. Regional variations (particularly for gasoline and electricity) can be significant.
- PHEV driving pattern simplification. PHEV electric/gasoline split is based on EPA range ratios, not real-world charging behavior. Actual electric fraction depends on daily driving distance, charging frequency, and route patterns.
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.