Uber bills its ride-hailing service as “smarter than a taxi.” Yet in many cases, taking a local taxi service might be a smarter choice for your wallet.

One of the reasons for Uber’s success? Its fares can be cheaper than taking a taxi. That’s especially true for longer trips that cost more than $35, according to analysis by Anastasios Noulas, a data scientist at Lancaster University in the U.K. Overall, says Noulas, Uber is often the more economical choice outside of large cities.

But there are many times when a taxi is a better alternative. For quick trips when the fares are below $35, for instance, a taxi could be the cheaper option. Such trips account for about 94 percent of taxi fares, Noulas says.  

Watch Out for Surge Pricing

A taxi is likely to also be the better option when demand is high. That’s because during such times, Uber and rival services such as Lyft rely on surge pricing to boost fares by up to four times the price. The theory is that by allowing drivers to charge a premium, more drivers will get behind the wheel, which will help meet demand from passengers.

Surge pricing can happen more often than you’d expect in some high-traffic neighborhoods, such as New York City’s Times Square. Noulas says the practice affects about 25 percent of UberX cars—the budget option for riders—in New York City. The result is that the median price for a yellow cab ride in New York, says Noulas, is $19.50 versus $23.50 for an UberX ride.

Even without surge pricing, UberX can be more expensive than taking a taxi, especially for shorter trips. Uber charges a minimum fare of $8 for simply getting into the car, compared with $2.50 for New York’s yellow cabs. UberX is still often more expensive even after you take into account tipping taxi drivers, Noulas found. Uber drivers typically don’t accept tips.

Apps to Get the Best Deal

While Uber provides an estimate of a trip’s cost before you get in the car, the final price might surprise you because of factors such as traffic or weather. In one notable case, a woman earlier this year told The Chicago Tribune she “nearly passed out” after Uber charged her $640 for a trip to the airport during a snowstorm. Taxi services typically rely on fixed fare schedules or meters.

Several apps and websites can help you figure out whether you’ll be better off taking an Uber or a taxi, including RideGuru and WhatsTheFare. Another, OpenStreetCab, which Noulas created, provides an analysis of Uber and local taxis in New York and London. The app (Android and iOS) steers you to the cheaper option and can save you about $7 on average per trip, Noulas claims. 

The cost of a ride might be only one factor in your decision on how to get around. You might prefer the ease of using the Uber app, since you can track where drivers are while you wait to be picked up and you can rate drivers.

But not all Uber drivers know their cities as well as taxi drivers do. They usually rely on phone-based GPS to get around. But technology might not be able to replace the smarts local taxi drivers. London cabbies, for instance, must study its labyrinthine street layout for years and pass a grueling test—called "the Knowledge"—before becoming licensed.