On the first day I commuted to work by bike, I woke up earlier than usual, overstuffed my backpack with snacks, clothes and towels and hit the road at 07:30.

After a few miles, the GPS route I was following disappeared, forcing me to pull over to find the route again. Meanwhile, lorries and angry drivers were honking and overtaking me at high speed at a very busy junction. After more than an hour in the saddle, I finally arrived at the office, stressed out – but on time.

For those of us who live in crowded cities with bad traffic and scarce parking, there are two main options for commuters: public transport and cycling.

When you compare the two, it seems like an easy win for the former: cycling costs less and is good exercise. It’s these factors — along with expansion of bike lanes and cycling advocacy groups — that are helping drive growth in bike commuting in many countries around the world.

In the US, the number of commuters by bike increased by 60% over the past decade

In the US, according to the US Census Bureau, the number of commuters by bike increased by 60% over the past decade (from 488,000 in 2000 up to 786,000 during the years 2008-12) and 40% from 2006 to 2013 (from 623,000 to 882,000), even though they still account for just 0.6% of the total commuting population (a whopping 143 million workers).

In London, according to the most recent census data, the number of cycling commuters more than doubled, from 77,000 in 2001 to 155,000 in 2011. In the UK as a whole in 2014 (the most recent year available), a record 183,423 employees participated in the Cycle to Work scheme, a Government’s scheme that enables employees to get bikes and accessories tax-free through their employers. .

When I lived in in Turin, Italy I always cycled: compared to public transport, it was always faster and almost cost-free. I thought the same would apply in London. But that lasted only until I started to ride bikes for living (I was working for a cycling magazine). That’s when I gave up cycling to work.

At the time, my office was 12 miles (19km) from my home – which meant either an hour in the saddle or an hour on the overground train. Although the time was the same, cycling was much cheaper: since I already owned everything I needed to commute by bike, the two-wheeled alternative was effectively cost-free. Public transport, on the other hand, was £146 (at the time, $210) a month.

That simple calculation, though, didn’t take a couple of factors into account. For one, the need for consistency. If I relied on cycling and didn’t buy a month-long pass for the train – but then changed my mind one morning because, say, of bad weather – I was looking at an extra £11 ($15.80 at that time) round-trip. Doing that just twice a month added up quickly.

On a bicycle, the traffic, the red lights and pollution made the ride a nightmare

The calculation also didn’t include stress. On a bicycle, the traffic, the red lights and pollution made the ride a nightmare. Sitting on the train and reading was the more enjoyable option.

Of course, that’s not true for everyone. But my experience made me wonder: is it really always cheaper and more convenient to commute by bike than with public transport?

Better by bike

Theodora Robinson, 27, started to commute by bike in March this year, because she was “sick of paying for the privilege of squeezing through rush hour on the tube”, and wanted a healthier and cheaper option.

The 27-year-old Londoner rides a Liv Avail – a mid-range road bike that she got free of charge through the UK’s Cycle to Work scheme. The bike, when she bought it, had a price tag of £750 ($950).

“My commute is around 40 minutes, depending on traffic,” she says. “I might take the Tube on occasion, but I'm rarely put off by the weather. It's definitely cheaper overall and more convenient and this year will cost half what it normally does, and even less if I carry on next year.” She says maintenance has cost very little so far because she had three free check-ups in the deal for the first year. “The biggest outlay was upgrading the tyres for about £40 ($50).”

Italian Marco Mazzei, 52, is a corporate social media manager from Milan and a keen cyclist. He started to cycle to work occasionally in 2010, but two years later he made an even bigger commitment. He sold his car. He currently rides 16km (10 miles) each way to get to work.

Mazzei rides a folding bike that cost 1,100 euro ($1,200) – its small enough to take on the train when needed and easy to carry into the office. “I can bring it right under my desk and take the overground without paying for an extra ticket,” he says. He spends about 100 euros ($110) on yearly maintenance costs.

“I know I save money,” says Mazzei, although he’s never done the pen-and-paper calculation.

Even if not at the same speed as in Europe, commuting by bike is also finding new momentum down under.

“Commuting by bike in Australia is small, but growing,” says Benny Horn, 34, who is responsible for cycling-development plans for one of Sydney’s city councils. 

Horn started to cycle to work in 2008, when he was tired of slow commutes, long walks and expensive train trips. His commute takes 15 minutes, and he estimates it costs him about A$200 ($150) a year to ride, on top of an up-front cost of A$700 (500 euros) to buy the bike. “Commuting by train in Sydney would set me back A$2,000 ($1,500) a year.”

Weighing the costs

So, is cycling to work is always cheaper than using public transport, the answer – based on a pure data analysis – is: no. In the short- and medium-term (depending, of course, on where you live), public transport can actually be a better value.

Using data from industry bodies, retailers and national transportation sites, BBC Capital compared the cost of cycling to the cost of public transport in 12 cities to find out where a two-wheeled commute could save you the most money.

We took the average cycling costs for a country – the cost of a bicycle, accessories and maintenance – and compared that to the cost of a monthly travel card on public transport. We found that although cycling has a high up-front cost, those costs are soon recouped in a city with expensive public transport. The lower the public transport cost, the longer it takes for cycling to become cheaper than transit.

If you live in an expensive city like New York or London, cycling is the most cost-effective option. It won’t take much time to pay off the initial investment of the bike, compared to the cost of monthly travel cards (assuming you just buy a brand-new bike for about £300 or $200, it takes 2.1 months in London and 1.7 months in New York to break even compared with a monthly transit card).

In Krakow, public transport can actually be less expensive than using a bike regularly

But in other cities, that’s not the case. In Krakow, Poland for example, public transport is cheaper than in other cities (equal to $22.90 for a monthly travel card) but the average cost of a brand-new bike in 2015 was still relatively high ($427).

That means it will take much longer to recoup the cost of the bike alone: 18.7 months of taking public transport, to be precise, and that excludes other costs. Add in gear and maintenance, and in Krakow public transport can actually be less expensive than using a bike regularly.

Even when you’re confident that you’re saving more long-term by cycling than with public transport, be aware of the “hidden” costs like bike maintenance – which is essential in order to keep the bike in good shape and make it last longer.

Avid cyclists should plant to spend $320 to $530 for annual maintenance, says Ed Reynolds, a board member of the Professional Bicycle Mechanics Association in the US. That cost covers biannual tune-ups and replacing parts like chains, brake pads, tires and cables.

As for your bike, it should last longer. “The simple answer,” he adds, “would be five to eight years. That does depend on how well the bike is maintained – an old adage in the bicycle industry is: ‘There are two ways to kill a bicycle; ride it a lot or don’t ride it at all’.”

To comment on this story or anything else you have seen on BBC Capital, please head over to our Facebook page or message us on Twitter.