If you're looking for a quick caffeine fix in the United States, you're probably never too far away from either a Starbucks (NASDAQ:SBUX) or Dunkin Donuts. Both coffee slingers have set up shops on thousands of corners and strip malls throughout the country, and they're both expanding internationally as well.

Both companies' stocks are up just modestly in 2017, lagging the returns of the S&P 500. Starbucks has suffered from poor comparable-store sales in the fourth and first quarters. Dunkin Brands (NASDAQ:DNKN) has performed reasonably well, but its shares have been dragged down with the rest of the restaurant industry. Nonetheless, both trade near their all-time high prices.

So, which is a better buy for your portfolio: Starbucks or Dunkin?

Dunkin Donuts storefront

Image source: Dunkin Donuts.

A cash machine

Dunkin Brands takes a much different approach than Starbucks when it comes to expanding. All of its stores are franchises, which means it doesn't have to outlay very much cash to open a new store. Starbucks, comparatively, likes to control as many of its stores as it can.

The result is that Dunkin's operating margin is considerably higher than that of not only Starbucks, but also many other peers in the restaurant industry. Over the last 12 months, it posted an operating margin of 50.5%, and that number continues to climb higher. Management expects operating margin to improve further in 2017, with revenue growth of just 2% but adjusted operating income growth of 8% to 10%.

What's more, Dunkin's capital expenditures are next to nothing. Last year, Dunkin had just $15 million in capital expenditures and produced $276 million in operating cash flow. Starbucks invested nearly 100 times as much, $1.44 billion, to produce operating cash flow of $4.6 billion. While the cash flow numbers aren't as big, it doesn't take nearly as much capital to keep Dunkin growing and producing tons of cash flow.

The Starbucks app on an iPhone with Starbucks cup in background

Image source: Starbucks.

Starbucks is taking over the world

Starbucks already has over 25,000 stores around the world, and it expects to open another 2,100 in 2017. Dunkin has around 20,000 stores itself split between Dunkin Donuts and Baskin Robbins, but it's expanding much more slowly, adding just 700 total locations last year.

While the continued expansion will put pressure on Starbucks' free cash flow, it's producing strong returns for shareholders and driving top-line growth. Starbucks expects to open 12,000 more stores from the end of 2016 to 2021.

Starbucks thinks its new stores can drive results just as well as its more established locations, and they ought to support top-line growth in the high single-digits. Aiding that is mid single-digit same-store sales growth, although it's missed that target in its most recent quarters. It's targeting $35 billion in revenue by 2021, up from $21 billion in 2016. That implies annual growth of over 10%.

Meanwhile, Starbucks has an opportunity to improve its overall operating margin by leveraging its stores and growing its sales during dayparts beyond breakfast. Continued growth in consumer packaged goods represents another opportunity. Dunkin, notably, has equally strong prospects in the grocery aisle.

A look at valuation

Metric

Starbucks

Dunkin Brands

Price-to-earnings

28.7

24.9

Enterprise value/EBITDA

15.4

15.6

Free cash flow yield

3.4%

4.5%

Starbucks' shares are a bit more expensive than Dunkin's right now, but it's certainly deserved. Starbucks' rapid expansion and improving profit margin mean it should continue to exhibit double-digit profit growth over the next five years and more. Analysts currently estimate EPS growth of over 15% on average over the next five years.

The consensus for Dunkin's EPS growth is just 12% annually, which will be driven mostly by operating margin improvements. But Dunkin seems to have a lower ceiling on profit growth considering it already has such a high operating margin.

Dunkin's strong cash flow may be intriguing for investors who like to see a business with low capital intensity that can easily return more cash to shareholders in the form of dividends and buybacks. But Starbucks' growth plan overshadows Dunkin so much that it's probably the better buy for most investors, especially considering the similar valuations based on earnings.

Adam Levy has no position in any stocks mentioned. The Motley Fool owns shares of and recommends Starbucks. The Motley Fool recommends Dunkin' Brands Group. The Motley Fool has a disclosure policy.