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. There are two data sources:
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). This is the primary, real-time data source for every vehicle-specific figure on the page.
- 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.
DOE Alternative Fuels Data Center historical gasoline price series, used only by the Cost Uncertainty Monte Carlo simulation (Fig. 5, see Visualizations). Unlike the FuelEconomy.gov data, this is not fetched live—the 73 real year-over-year percentage changes from the DOE's "Average Annual Retail Price of Gasoline, 1950–2023" series are embedded directly in the page's code, since the series does not change and does not need to be fetched per visit.
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.
Fig. 5: Cost Uncertainty (Monte Carlo Percentile Fan)
Unlike the fixed-percentage scenarios in Fig. 3, this chart quantifies fuel-price uncertainty statistically. The model resamples (with replacement) the 73 real year-over-year percentage changes in the U.S. Department of Energy's "Average Annual Retail Price of Gasoline, 1950–2023" series, compounding a randomly drawn change for each year of the ownership period, across 1,500 simulated price paths. At each year, the 10th, 25th, 50th (median), 75th, and 90th percentiles of cumulative cost across all simulated paths are plotted as a fan: a light outer band (10th–90th percentile) and a darker inner band (25th–75th percentile), with the median as a highlighted line. Because the resampling draws from actual historical annual changes rather than an assumed distribution shape (such as a normal distribution), the simulation reflects the real fat-tailed, skewed behavior of historical gasoline prices, including energy-crisis years. For battery electric vehicles, this chart renders as a flat, zero-width band, since EV charging cost is not exposed to gasoline price volatility in this model.
Fig. 5b: Outcome Distribution (Histogram + Gaussian KDE)
A 24-bin equal-width histogram of the 1,500 simulated final-year outcomes from Fig. 5, overlaid with a Gaussian kernel density estimate using Silverman's rule-of-thumb bandwidth (h = 0.9·min(σ, IQR/1.34)·n-1/5), and a Normal distribution of the same mean and variance (dashed) for direct comparison. The gap between the KDE and the Normal curve is the same skew/kurtosis reported in the accompanying text. Mean and median are marked as separate reference lines since they diverge whenever the distribution is skewed. Renders as a single spike for BEVs (no cost variability to distribute).
Fig. 5c: Cumulative Probability (Empirical CDF)
The empirical cumulative distribution function of the same 1,500 outcomes: for any dollar value on the x-axis, the curve gives the fraction of simulations at or below it, read directly from the sorted outcome array (no distributional assumption). Plotted against the CDF of a Normal distribution with the same mean/variance (dashed) for comparison. P10/median/P90 are marked directly on the curve.
Fig. 5d: Historical Price Trend
An ordinary-least-squares regression of ln(price) on year index, fit across all 74 years of the DOE AFDC nominal gas price series (1950–2023) - a semi-log fit, the standard approach for a variable that grows multiplicatively rather than additively, so a constant compounding growth rate renders as a straight line. A 95% prediction interval band is computed with the standard formula SE_pred(x) = s·√(1 + 1/n + (x−x̄)²/Sxx). The fitted trend (solid) is then extrapolated forward through the user's own ownership-years input (dashed, shaded region, clearly separated from the fitted range by a "2023" divider) and that projected price is run through the selected vehicle's real fuel-consumption numbers to produce a trend-implied total cost, compared against the calculator's primary flat-price estimate. For BEVs, this projected cost is not computed, since gasoline price trends have no bearing on electricity cost - the chart states this directly rather than showing a fabricated number.
Fig. 5e: Tail Risk (Value at Risk & Conditional VaR)
Two standard quantitative risk-management metrics, computed directly from the same 1,500 simulated outcomes as Fig. 5b/5c: Value at Risk (VaR) at the 95th and 99th percentiles (the loss threshold such that outcomes exceed it only 5% or 1% of the time), and Conditional VaR / Expected Shortfall (CVaR) at 95%, the mean of all simulated outcomes at or beyond the VaR-95 threshold. CVaR is reported because VaR alone describes only a threshold, not how severe outcomes get once you're past it - CVaR is consistently the harsher, more complete number. Both are vehicle/years/miles/mix-dependent, since they're computed from the user's own simulated outcome set. Not computed for BEVs, for the same reason as Fig. 5d.
Fig. 6: Sensitivity Tornado
A tornado diagram ranking which input variables have the largest effect on total fuel cost. Each of four inputs—annual miles, city/highway driving mix, fuel (or electricity) price, and vehicle efficiency—is independently perturbed by ±20% (or ±20 percentage points for driving mix, clamped to 0–100%) while holding all other inputs at the user's current settings, and the resulting low/high total-cost outcomes are plotted as horizontal bars. Bars are sorted by swing size (widest at top), with a dashed reference line marking the unperturbed base-case total. Vehicle efficiency is perturbed on the underlying city/highway MPG or MPGe rating (or kWh/100mi consumption rate for BEVs, inverted so a larger number always represents worse efficiency), not as a naive linear scaling of cost, since fuel cost is inversely related to fuel economy.
Fig. 7: CO₂ by Vehicle Class
This vehicle's EPA-measured CO₂ tailpipe emissions (g/mile) plotted against class averages for 12 body-style classes, computed directly from DOE/EPA's MY2026 Fuel Economy Guide (the same source and the same 12 classes as Fig. 8, via the "Comb CO2 Rounded Adjusted (as shown on FE Label)" column, gasoline/diesel/hybrid vehicles only, 784 vehicles). Not shown for BEVs, which have zero direct tailpipe emissions. A small number of rare or ambiguous EPA vehicle classes (e.g., certain special-purpose or cab-chassis configurations) fall outside these 12 categories and show no comparison marker.
Fig. 8: Where You Rank
A box-plot comparison of this vehicle's fuel cost per mile against 1,430 real MY2026 vehicle configurations from DOE/EPA's official Fuel Economy Guide (Data/20260129 MY26 FE Guide for DOE...xlsx, sheets FEguide/EV/PHEV), grouped into 13 body-style classes. Boxes show the 25th–75th percentile of each class, whiskers the 5th–95th, with a white tick at the median. Cost per mile is computed as reference fuel or electricity price divided by each vehicle's EPA-rated combined MPG or MPGe (1 gallon-equivalent = 33.7 kWh, the standard EPA conversion factor), using fixed reference prices ($3.30 regular, $3.84 midgrade, $4.19 premium, $3.76 diesel, $0.165/kWh electricity) so gasoline, hybrid, EV, and PHEV vehicles all sit on one common, comparable axis rather than incomparable MPG/MPGe/cost units. PHEV figures blend gas-mode and electric-mode cost/mile 50/50, a default utility-factor assumption since the Fuel Economy Guide does not publish a per-vehicle electric-use share. The current vehicle's own class is highlighted, with its actual cost/mile marked and its percentile rank within that class computed by piecewise-linear interpolation between the class's known percentile breakpoints. This compares against today's MY2026 new-vehicle lineup as a whole, not specifically vehicles from the selected model year, since the Fuel Economy Guide is a single-model-year snapshot.
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 in the primary estimate. The headline total cost (Sections 01–08) applies the current EPA fuel price uniformly across the entire ownership period. No inflation modeling, fuel price forecasting, or future price speculation is applied there. The fuel price scenario fan chart (Fig. 3) illustrates sensitivity to a few fixed price changes but does not predict prices. The separate Cost Uncertainty section (Fig. 5) does model future price variation statistically, by resampling real historical annual gasoline price changes—this is a backward-looking volatility model, not a forecast of where prices are actually headed, and it does not know about future events any more than a fixed price assumption does.
- 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.
Built using AI and U.S. government data sources.