Skip to content
RoadCostFuel & EV tools
Menu

Transparency

Methodology and research status

This page documents what the calculators do, how the formulas are tested, which constants are used, and what has deliberately not been published yet.

Formula library and constants

All calculations live in src/lib/calculations.ts. The main constants are:

Constants used by the calculators
ConstantValueUse
Imperial gallon4.54609 LUK MPG and UK fuel cost
US gallon3.785411784 LUS MPG and US fuel cost
Mile1.609344 kmDistance conversion
MPG UK factor282.480936L/100 km ↔ MPG UK
MPG US factor235.214583L/100 km ↔ MPG US
Mechanical horsepower745.6998716 Whp and bhp conversions
Metric horsepower735.49875 WPS conversions
Gasoline-equivalent energy33.7 kWh/US galMPGe conversions

The MPG factors are derived from the gallon and mile definitions rather than stored as unexplained magic numbers. The 33.7 kWh figure follows the EPA gasoline-equivalent basis; EPA MPGe includes charging losses. See the MPGe guide.

Verification approach

Each conversion has an independent test with a known expected value. Tests also cover zero, negative, missing and boundary inputs, and the four market paths (UK, US, EU, CH). The current suite has 40 tests. It runs with npm test.

A test passing means the code matches the documented formula. It does not validate a user’s fuel price, a vehicle’s real-world consumption, a tariff or a regulation.

Formula verification log (initial release)
FormulaTestStatus
L/100 km → MPG UK5 L/100 km → 56.50 MPG UKPassing
L/100 km → MPG US5 L/100 km → 47.04 MPG USPassing
UK fuel cost100 mi, 50 MPG UK, 145p/l → £13.18Passing
US fuel cost300 mi, 30 MPG US, $3.50/gal → $35.00Passing
EU fuel cost500 km, 6.5 L/100 km, €1.75/l → €56.88Passing
CH fuel cost500 km, 6.5 L/100 km, CHF 1.75/l → CHF 56.88Passing
EV charging45 kWh battery, 90% efficiency, 25p/kWh → £12.50Passing
EV vs petrol10,000 mi, 50 MPG UK vs 3.5 mi/kWh → annual differencePassing
kW ↔ PS ↔ hp100 kW → 135.96 PS / 134.10 hpPassing
Zero input handling0 L/100 km → infinite MPGPassing
Invalid input handlingNegative and zero denominators rejected or flaggedPassing

Unit policy

  • UK defaults: miles, MPG UK, pence per litre, GBP.
  • US defaults: miles, MPG US, dollars per US gallon, USD.
  • Europe defaults: kilometres, L/100 km, euros per litre, EUR.
  • Switzerland defaults: kilometres, L/100 km, Swiss francs per litre, CHF.
  • MPG is never shown without its system when the system matters.
  • MPGe is identified as an EPA energy-equivalence rating, not liquid-fuel MPG.
  • PS, hp and bhp are identified separately; bhp is treated as mechanical hp with a caveat.

Data policy

Fuel prices, electricity prices and vehicle efficiency are inputs. The site does not publish a national price, a live station price, a vignette price, a toll price or a tax rate in this build. This avoids presenting stale or invented data as current.

If a time-sensitive page is added later, it must state the jurisdiction, vehicle category, effective date, official source URL, date checked and known caveats. It must also have a maintenance owner and update trigger.

Deferred work

The following candidates were not published because they depend on official data or verification that is not in place:

  • Austria, Switzerland and Slovenia vignette price/validity pages.
  • UK VED, MOT, ULEZ, LEZ, Congestion Charge, Dartford and M6 Toll pages.
  • US toll, turnpike and state EV registration-fee pages.
  • IRS standard mileage rate and HMRC approved mileage-rate pages.
  • EV charging-time, home-charger installation and tariff-comparison tools.
  • Depreciation, financing, insurance and total-cost-of-ownership models.
  • Country-specific translated pages and local-language keyword clusters.
  • Programmatic number-specific URLs. Numeric examples are handled inside the converters.

Each requires a source record, a last-verified date, a maintenance process and, for regulatory pages, a clear separation between official requirements and estimates.

Maintenance

On any formula change: update the library, update the tests, update the formula text and the verification log, then record the change in the corrections log. Do not change a date without checking the page. Do not add a year-specific page unless the information genuinely differs by year.

Primary references

Page last reviewed: . Formulas are covered by automated tests. Prices are inputs, not live data.