Petrol car
Electric car
Cost per mile, to scale
Why the imperial gallon
Petrol pence per mile is calculated as price per litre × 4.546 ÷ MPG, using the imperial gallon (4.546 litres) since UK fuel economy is still quoted in miles per imperial gallon on every spec sheet and pump receipt. This is the same formula used on the fuel cost calculator, so the two tools will always agree for the same inputs.
What's deliberately left out
This comparison is running cost per mile only: fuel or electricity, nothing else. Purchase price, depreciation, servicing, insurance and Vehicle Excise Duty all differ between petrol and electric cars and none of them are included here, because they depend on the specific cars being compared rather than a formula. If you want the full financial picture rather than just the pence-per-mile running cost, treat this as one input into a total cost of ownership comparison, not the whole answer.
Reading the break-even price
The break-even electricity price is the p/kWh at which the EV's running cost per mile exactly matches the petrol car's, given its MPG and fuel price. Above that price, the petrol car is cheaper to run per mile; below it, the EV is. It moves with both petrol price and MPG, so a more efficient petrol car raises the electricity price needed to compete.
Going further
For the EV side alone, including charging losses and a breakdown of range and full-charge cost, see the EV charging cost calculator. If you charge from a mix of tariffs, the home vs public charging comparator lines several rates up side by side.