Comparing running costs mathematically
Discussion
Hi All,
As lots of us are, I am a numbers geek - I like doing man maths to either justify what I want to buy anyway or to talk me out of something I know I really shouldnt be doing but want to. I work in IT so Ive always done this with code, the most recent iteration being a website so I can easily get to it via a phone should I feel the need. Given its therefore accessible, I wondered if anyone had any comments on the way Ive approached the problem of comparing cars and have better ways they do themselves - Id be really interested to know other peoples methodologies. My calculator is here - my main motivation was as fuel price differentials fluctuate to see if fast petrol is ever cost effective vs diesel (sadly it never is). This is really just for fun, but who said maths cant be for fun..
https://mpgcalc.co.uk/compare
Im also stingy, and I like to know the cheapest way of filling up. The government, in a brilliant move, have forced the biggest fuel companies to publish their fuel prices. I built an api that pulls all their feeds together and tells you the fuel prices of the nearest 5 stations, plus distances and a calculator that lets you work out where itll cost you the least to fill up. Sad but intriguing :-)
https://mpgcalc.co.uk/station
Theres no commercial anything on the site, apologies if posting links is frowned up, please feel free to delete/ignore/flame at will
Charlie
As lots of us are, I am a numbers geek - I like doing man maths to either justify what I want to buy anyway or to talk me out of something I know I really shouldnt be doing but want to. I work in IT so Ive always done this with code, the most recent iteration being a website so I can easily get to it via a phone should I feel the need. Given its therefore accessible, I wondered if anyone had any comments on the way Ive approached the problem of comparing cars and have better ways they do themselves - Id be really interested to know other peoples methodologies. My calculator is here - my main motivation was as fuel price differentials fluctuate to see if fast petrol is ever cost effective vs diesel (sadly it never is). This is really just for fun, but who said maths cant be for fun..
https://mpgcalc.co.uk/compare
Im also stingy, and I like to know the cheapest way of filling up. The government, in a brilliant move, have forced the biggest fuel companies to publish their fuel prices. I built an api that pulls all their feeds together and tells you the fuel prices of the nearest 5 stations, plus distances and a calculator that lets you work out where itll cost you the least to fill up. Sad but intriguing :-)
https://mpgcalc.co.uk/station
Theres no commercial anything on the site, apologies if posting links is frowned up, please feel free to delete/ignore/flame at will
Charlie
That fuel costs page is very helpful, thanks.
I am similar and have put together a spreadsheet to compare costs for different cars I'm considering. It looks at depreciation, repayments for finance or leasing, fuel economy including fuel/electric price, servicing, other maintenance, tyres, tax, insurance. It's been helpful in decision making a number of times, and is obviously only as good as the information put into it which can be helpful when justifying a decision (not necessarily to myself!).
I am similar and have put together a spreadsheet to compare costs for different cars I'm considering. It looks at depreciation, repayments for finance or leasing, fuel economy including fuel/electric price, servicing, other maintenance, tyres, tax, insurance. It's been helpful in decision making a number of times, and is obviously only as good as the information put into it which can be helpful when justifying a decision (not necessarily to myself!).
Good work, this will save me having to explain how to calculate these to other people! 
One improvement I can suggest is relates to the which fuel station calculator comparing cost of buying fuel from 2 different stations. At the moment it does the calculation based on a single trip to the fuel station and nothing else. Given that on many occasions people need to return to the place they started out from rather than continue on with their journey from the fuel station, I think it would be useful for this calculator to provide both single journey and return journey cost comparisons, especially for those of us with big thirsty engines living rurally!
Also, some fuel stations don't seem to appear on there, both independent and franchise (at least one of them is a BP, there don't seem to be any Texaco stations etc., so not just small independent ones). Is there any way of adding the missing ones?

One improvement I can suggest is relates to the which fuel station calculator comparing cost of buying fuel from 2 different stations. At the moment it does the calculation based on a single trip to the fuel station and nothing else. Given that on many occasions people need to return to the place they started out from rather than continue on with their journey from the fuel station, I think it would be useful for this calculator to provide both single journey and return journey cost comparisons, especially for those of us with big thirsty engines living rurally!
Also, some fuel stations don't seem to appear on there, both independent and franchise (at least one of them is a BP, there don't seem to be any Texaco stations etc., so not just small independent ones). Is there any way of adding the missing ones?
Edited by QuickQuack on Friday 12th January 16:47
Genius! Bookmarked...
Just come feedback...
If I was to nitpick (for discussion) the fuel station comparison includes the outbound journey cost... should it not also include the return trip?
Being lazy, a facility to populate the name, distance and cost per litre fields in the fuel station comparison from say a tick-box for two selected stations would also be handy!
The running cost calculator has shown me that leasing/pcp'ing a more economical car than my wife's 19mpg X5 even on her relatively modest mileage would sort of make financial sense...
Just come feedback...
If I was to nitpick (for discussion) the fuel station comparison includes the outbound journey cost... should it not also include the return trip?
Being lazy, a facility to populate the name, distance and cost per litre fields in the fuel station comparison from say a tick-box for two selected stations would also be handy!
The running cost calculator has shown me that leasing/pcp'ing a more economical car than my wife's 19mpg X5 even on her relatively modest mileage would sort of make financial sense...
Edited by Robertb on Friday 12th January 16:58
QuickQuack said:
Good work, this will save me having to explain how to calculate these to other people! 
One improvement I can suggest is relates to the which fuel station calculator comparing cost of buying fuel from 2 different stations. At the moment it does the calculation based on a single trip to the fuel station and nothing else. Given that on many occasions people need to return to the place they started out from rather than continue on with their journey from the fuel station, I think it would be useful for this calculator to provide both single journey and return journey cost comparisons, especially for those of us with big thirsty engines living rurally!
Also, some fuel stations don't seem to appear on there, both independent and franchise (at least one of them is a BP, there don't seem to be any Texaco stations etc., so not just small independent ones). Is there any way of adding the missing ones?
The fuel stations come direct from the retailers published apis. I could build a way to add stations, but there would be no (easy) way of getting the up to date fuel price data for them. Some of the station data is weird, but I believe its down to the business models in operation. I think some of the big players franchise out their stations, so you see say a BP or a Texaco appearing in a feed from a different company, and you see a lot of stations belonging to companies that do participate not showing, and I think thats because they are actually franchises. Unfortunately its only the biggest 14 (off the top of my head) retailers who are part of the scheme, which is a real shame as theres therefore a load of missing data. There is currently just short of 4000 stations in the db
One improvement I can suggest is relates to the which fuel station calculator comparing cost of buying fuel from 2 different stations. At the moment it does the calculation based on a single trip to the fuel station and nothing else. Given that on many occasions people need to return to the place they started out from rather than continue on with their journey from the fuel station, I think it would be useful for this calculator to provide both single journey and return journey cost comparisons, especially for those of us with big thirsty engines living rurally!
Also, some fuel stations don't seem to appear on there, both independent and franchise (at least one of them is a BP, there don't seem to be any Texaco stations etc., so not just small independent ones). Is there any way of adding the missing ones?
Edited by QuickQuack on Friday 12th January 16:47
I agree re the return journey from fuel stations. My nearest station in the db is 9 miles, so I just use 18 in the calculator (Discovery3 driver so my mpg massively influences the result for me). I wanted to keep it flexible so Ive just left it to the user to input as they see fit - Ill mull over how best I could accommodate the change nicely
Robertb said:
Genius! Bookmarked...
Just come feedback...
If I was to nitpick (for discussion) the fuel station comparison includes the outbound journey cost... should it not also include the return trip?
Being lazy, a facility to populate the name, distance and cost per litre fields in the fuel station comparison from say a tick-box for two selected stations would also be handy!
The running cost calculator has shown me that leasing/pcp'ing a more economical car than my wife's 19mpg X5 even on her relatively modest mileage would sort of make financial sense...
Fully agree about the tick boxes, Id like that also. Will add it to a list!Just come feedback...
If I was to nitpick (for discussion) the fuel station comparison includes the outbound journey cost... should it not also include the return trip?
Being lazy, a facility to populate the name, distance and cost per litre fields in the fuel station comparison from say a tick-box for two selected stations would also be handy!
The running cost calculator has shown me that leasing/pcp'ing a more economical car than my wife's 19mpg X5 even on her relatively modest mileage would sort of make financial sense...
Edited by Robertb on Friday 12th January 16:58
Thanks both for the thoughtful feedback, much appreciated
Good stuff - this is the sort of thing I usually do as a back-of-fag-packet type scribble when I start looking.
Will check again, but would need to incorporate likely length of ownership so depreciation could be included - it’s a big factor.
Also, would suggest a Man Maths section in the summary, such as…
Car 1 costs xx per mile, whereas Car 2 costs zz per mile. For the annual mileage entered, this is equivalent to £/p per day, which is about the cost of a coffee and muffin (it’s rarely more or less than a coffee and muffin - only the quality of beverage and baked goods varies…)
This would provide more people with the confidence to get the car they actually want rather than trying to convince themselves the fuel/insurance/tax differences are meaningful
Will check again, but would need to incorporate likely length of ownership so depreciation could be included - it’s a big factor.
Also, would suggest a Man Maths section in the summary, such as…
Car 1 costs xx per mile, whereas Car 2 costs zz per mile. For the annual mileage entered, this is equivalent to £/p per day, which is about the cost of a coffee and muffin (it’s rarely more or less than a coffee and muffin - only the quality of beverage and baked goods varies…)
This would provide more people with the confidence to get the car they actually want rather than trying to convince themselves the fuel/insurance/tax differences are meaningful

I really like the fuel stations site, I did notice though that when I use my home postcode it is missing at least 2 fuel stations that are closer than at least the bottom two options listed, one is Esso and one is BP.
It may be an error in where ever it is pulling the data from not listing them but thought i'd mention it.
Good work
It may be an error in where ever it is pulling the data from not listing them but thought i'd mention it.
Good work
PomBstard said:
Good stuff - this is the sort of thing I usually do as a back-of-fag-packet type scribble when I start looking.
Will check again, but would need to incorporate likely length of ownership so depreciation could be included - it’s a big factor.
Also, would suggest a Man Maths section in the summary, such as…
Car 1 costs xx per mile, whereas Car 2 costs zz per mile. For the annual mileage entered, this is equivalent to £/p per day, which is about the cost of a coffee and muffin (it’s rarely more or less than a coffee and muffin - only the quality of beverage and baked goods varies…)
This would provide more people with the confidence to get the car they actually want rather than trying to convince themselves the fuel/insurance/tax differences are meaningful
I agree depreciation should really be included. I've missed it out on this pass but I will work out a way of including or excluding it but way of a tick box or somthing, so its excludable if you just want simplicity.Will check again, but would need to incorporate likely length of ownership so depreciation could be included - it’s a big factor.
Also, would suggest a Man Maths section in the summary, such as…
Car 1 costs xx per mile, whereas Car 2 costs zz per mile. For the annual mileage entered, this is equivalent to £/p per day, which is about the cost of a coffee and muffin (it’s rarely more or less than a coffee and muffin - only the quality of beverage and baked goods varies…)
This would provide more people with the confidence to get the car they actually want rather than trying to convince themselves the fuel/insurance/tax differences are meaningful

Like the idea about the coffee and muffin, thats a good way of visualising it
paulrockliffe said:
Great stuff!
I built an app for my phone that lets you input pizza sizes and price to compare the price per square inch for optimum purchasing when consideirng how hungry me and the kids are.
LOL - and why not!I built an app for my phone that lets you input pizza sizes and price to compare the price per square inch for optimum purchasing when consideirng how hungry me and the kids are.
Kuwahara said:
That is a brilliant tool….
Thank you!
Jamescrs said:
I really like the fuel stations site, I did notice though that when I use my home postcode it is missing at least 2 fuel stations that are closer than at least the bottom two options listed, one is Esso and one is BP.
It may be an error in where ever it is pulling the data from not listing them but thought i'd mention it.
Good work
The fuel station data is ultimately coming from the fuel companies, and it could be theres stations missing. If you want to dm me I'll happily have a look in the raw data. What I susoect is going on though is that in addition to their own brand stations, the big brands also seem to franchise to smaller companies, so an Esso station might not be run directly by Esso and so they dont report on it directly. Ive noticed this quite a lot examining the raw data. Several of the smallest companies that are in the scheme actually report many different big brands like Esso and Texaco within their feeds, Im assuming for exactly this reason. Boring and interesting simultaneously!It may be an error in where ever it is pulling the data from not listing them but thought i'd mention it.
Good work
kevbernard said:
Cool stuff. Not relevant to the content, but what's the tech stack?
The website is an html/htmx front end with a golang back end . The backend holding the fuel station data is also golang, it amalgamates and normalises the fuel station data (several of the fuel companies take liberties with the formating of their json) and feeds it to the db. The distance calculations are run through the Google Maps api so the distance is accurate - I looked at some commercial apis initially and their distance measurements where as the crow flies, which can totally distort the numbers if for eg one fuel station is 2 miles away but on the other side of the M25!Gassing Station | General Gassing | Top of Page | What's New | My Stuff





