Should you switch to an EV, or buy petrol/diesel/hybrid? An interactive UK total-cost-of-ownership decision tool. Live at ev.riera.co.uk
  • JavaScript 75.8%
  • CSS 13.2%
  • HTML 11%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-27 18:19:36 +01:00
.github feat(content): cost explainers with sources, similar-tool links, funding 2026-06-26 23:24:57 +01:00
css fix: reconcile EV/ICE fields on powertrain switch + a11y/report polish 2026-06-27 18:19:29 +01:00
docs/superpowers/specs docs: design for charger-install cost + passive affiliate monetisation 2026-06-27 09:08:09 +01:00
js fix: reconcile EV/ICE fields on powertrain switch + a11y/report polish 2026-06-27 18:19:29 +01:00
test fix: reconcile EV/ICE fields on powertrain switch + a11y/report polish 2026-06-27 18:19:29 +01:00
vendor chore: tooling, docs, vendored Chart.js and Pages deploy config 2026-06-26 22:51:31 +01:00
.gitignore chore: tooling, docs, vendored Chart.js and Pages deploy config 2026-06-26 22:51:31 +01:00
AFFILIATE-SETUP.md feat: passive affiliate 'Next steps' links + charger field UI 2026-06-27 11:51:44 +01:00
CNAME Create CNAME 2026-06-26 23:25:15 +01:00
Find me webs and data which helps understand how t.md chore: init EV decision-tool repo with TCO research notes 2026-06-26 22:31:23 +01:00
index.html fix: reconcile EV/ICE fields on powertrain switch + a11y/report polish 2026-06-27 18:19:29 +01:00
LICENSE chore: tooling, docs, vendored Chart.js and Pages deploy config 2026-06-26 22:51:31 +01:00
package.json feat(model): UK total-cost-of-ownership engine with unit tests 2026-06-26 22:51:11 +01:00
README.md feat: passive affiliate 'Next steps' links + charger field UI 2026-06-27 11:51:44 +01:00

EV or not? — should you switch to electric, or buy petrol/diesel/hybrid?

A small, fast, no-backend web tool that answers a real money question:

Keep the car we've got, or replace it? And if we replace it — EV, petrol, diesel or hybrid; new or used? When does the change actually pay for itself?

It models total cost of ownership (fuel/electricity, depreciation, insurance, servicing, road tax, one-off repairs) and shows, live, the break-even year, the lifetime cost, the upfront cash needed, and pence-per-mile — with charts that update as you change the numbers. It has a first-class home-solar input, because charging from your own panels can take EV running cost down to a couple of pence a mile.

Live: https://ev.riera.co.uk

Why this exists

Most "EV vs petrol" calculators stop at fuel. The decision that actually matters to a household is the whole cost over the years you'll keep the car, including keeping what you already own. This tool puts keep-vs-switch on a fair footing and lets two people with different instincts ("let's get an EV" / "let's wait, money's tight") look at the same honest numbers.

Privacy

No accounts, no analytics, no server. Everything runs in your browser. The Share button simply packs your current inputs into the URL so you can send a comparison to someone — nothing is stored anywhere. The built-in templates contain no personal data; they're illustrative starting points you edit.

How it works

  • js/model.js — the pure total-cost-of-ownership maths (no DOM); the formulas live here.
  • js/onboarding.js — the guided Start here front door: a few plain-language questions that build a sensible comparison, so you need no car knowledge to begin (skippable; power users go straight to the dashboard).
  • js/templates.js — anonymised starting scenarios + editable UK default rates.
  • js/charts.js — the cumulative-cost (crossover) line chart and the cost-breakdown bar.
  • js/app.js — wires inputs ↔ model ↔ charts, renders the pence-per-mile gauges, syncs the URL.
  • index.html / css/styles.css — a single-viewport dashboard with a detailed report below.
  • vendor/chart.umd.min.js — Chart.js, vendored (no CDN/runtime third-party dependency).

It's plain HTML/CSS/ES-modules — no build step. GitHub Pages serves the repo as-is.

Develop

npm test          # node --test — runs the model unit tests
npm run serve     # python3 -m http.server 8000  → open http://localhost:8000

Method, in one paragraph

Fuel = (miles ÷ MPG) × 4.546 × £/litre (UK gallon). Electricity = (miles ÷ miles-per-kWh) × a blended £/kWh from your home/public/solar mix. Cumulative cost = running costs + reducing-balance depreciation + one-off repairs; buying a car is treated as converting cash to a depreciating asset (not an instant loss), which is what makes keep-vs-switch comparable. Break-even is the year the switch's cumulative cost drops below keeping your current car. Default rates are illustrative UK 2026 values from the calculators surveyed in the project research note — replace them with your own quotes.

Guidance only — not financial advice.

Support

If this helped you make a decision, you can buy me a coffee — entirely optional, and there's a discreet link in the page footer too.

The "Next steps" links in the report are affiliate/referral links. To make them earn (and for the owner setup steps), see AFFILIATE-SETUP.md.

Licence

MIT — see LICENSE.