Apple (AAPL 0.38%) and Microsoft (MSFT -2.56%) are two titans of the technology industry -- and two of the largest companies in the world. While Microsoft generates most of its revenue from its software businesses, Apple's bread and butter has historically been its mobile hardware products. Which of these big tech leaders is the better buy right now?

Read on to see why two Motley Fool contributors come down on different sides of the issue.

Apple has been innovating for decades

Parkev Tatevosian: Apple is one of the most iconic businesses in the world. It has achieved that status by repeatedly creating innovative products, including the iPhone, iPod, iPad, Apple Watch, and AirPods. This history of innovation is one of the primary reasons to invest in Apple. It would be a less lucrative stock if its only claim to fame were the iPhone. Multiple products with billions in sales show evidence of a capability to repeatedly deliver products consumers love. 

That skill has helped Apple grow from $156 billion in revenue in 2012 to $366 billion in sales in 2021. Consumers so desire its items that they command premium prices, allowing Apple's operating income to explode from $55 billion to $109 billion in that same time. An added benefit to shareholders is that Apple has developed a sticky ecosystem.

Once customers buy an iPhone and customize it to their liking, they are less likely to switch to another brand when upgrading. A switch could mean losing content, playlists, and preferences that some spend hours personalizing.

The one reason to hesitate before buying Apple stock is that its excellent prospects are no secret to the market. Apple's stock is trading at a relatively expensive valuation at a price-to-earnings ratio of 28.6 and a price-to-free-cash-flow ratio of 26.5. 

AAPL Price to Free Cash Flow Chart.

AAPL Price to Free Cash Flow data by YCharts.

Those are near the higher end of its historical averages along those metrics. Still, paying a small premium for an excellent business can deliver exceptional returns for investors in the long run. 

Microsoft: The software giant is built for the future

Keith Noonan: Apple's hardware business, associated software ecosystem, and brand strength are undeniably fantastic, but I think that Microsoft's greater focus on software makes it a better play for the long term. Growth for cloud-based applications and services is still just getting started, and Microsoft is poised to benefit as companies carry out digital-transformation initiatives and adopt and launch new software.

Microsoft's Azure cloud infrastructure service stands as one of the largest and most profitable offerings in the category, and it has a huge runway for profitable growth over the long term. Despite the somewhat challenging macroeconomic backdrop, Microsoft reported that it added record numbers of new contracts in the greater-than-$100-million and greater-than-$1-billion categories last quarter.

Cloud infrastructure is a secular growth market, and Azure's strengths have Microsoft poised to benefit from its long-term expansion. Spending on digital transformation initiatives and migration to the cloud will still continue even if economic conditions are unfavorable in the near term, and I think this dynamic gives Microsoft an edge over Apple at today's prices.

Apple has been able to generate fantastic margins on mobile hardware, and its user base spends far more on app purchases compared to users of Alphabet's Android operating system. However, the company's heavy reliance on hardware sales could make growth harder to deliver going forward -- particularly if attempts to branch into new product categories don't prove successful.

Which big tech giant should you buy today?

For investors who are confident in the long-term growth of the technology sector, investing in both Microsoft and Apple could be the right play. Otherwise, choosing between the two tech giants should come down to which company's respective product offerings and growth opportunities you think look stronger.

If you're aiming to benefit from the evolution of cloud infrastructure and productivity software services, Microsoft is probably the better fit. However, if you see more promise in Apple's high-margin hardware and evolving software and services ecosystem, the iPhone company's stock should be an obvious portfolio addition.