After reaching multi-year lows in 2024, Dollar General (DG -0.20%) and Dollar Tree (DLTR -0.98%) are staging epic recoveries in 2025.

Year to date (YTD) at the time of this writing, Dollar General has surged a staggering 49.5% and Dollar Tree is up 25.2%, compared to a mere 2.1% gain in the S&P 500 (SNPINDEX: ^GSPC).

Even with those gains, both stocks have drastically underperformed the S&P 500 and larger retailers like Walmart (WMT -0.65%) and Costco Wholesale (COST -1.34%) over the last few years.

Here's what's driving the rebound in discount retailers, and whether investors are better off with a 50/50 split of Dollar General and Dollar Tree or Walmart and Costco.

Red shopping cart in the aisle of a store.

Image source: Getty Images.

Signs of improvement

The rebound in Dollar General and Dollar Tree provides a good lesson on the importance of expectations and valuation.

Going into this year, expectations for the discount retailers were as low as they could be. Both companies were struggling to offset inflationary pressures with price increases.

In 2021, Dollar Tree upped the base price of its products to $1.25, which cushioned profits but strained demand. It's also worth mentioning that Dollar Tree is selling Family Dollar in the second quarter of 2025 for about $1 billion -- a significant loss compared to the roughly $9 billion purchase price in 2015.

Frequent customers of Dollar General and Dollar Tree can be more sensitive to inflation and overall higher living costs than retail outlets that aren't so value-focused. As a result, both companies rely on sales volume to offset their razor-thin margins. The business model can work well when consumer spending is strong, but it can backfire when people tighten their purse strings.

As you can see in the following chart, Dollar General continued boosting sales, but margins are near a 10-year low, reflecting pricing pressure. Dollar Tree's margins are holding up, but its revenue is down significantly due to store closures and demand pressures.

DG Operating Margin (TTM) Chart

DG Operating Margin (TTM) data by YCharts.

Despite lackluster results, recent financials for both companies show signs of improvement. Dollar General grew sales and earnings in its recent quarter. Dollar Tree got a jolt from improving results and potential cost savings from the Family Dollar spin-off.

Results for Dollar General and Dollar Tree weren't great, but because expectations were so low and both stocks were so beaten down, the stage was set for an epic rebound, even if results were mediocre. However, some investors may prefer to go with higher-quality names like Walmart and Costco.

Delivering value and driving customer loyalty

Walmart and Costco have ultra-razor-thin margins, often lower than those of Dollar General and Dollar Tree. But the key difference is that Walmart and Costco deliver masterfully on their value propositions to customers.

Walmart caters to value-focused customers, just like dollar stores. Yet, it has grown sales steadily and sustained decent margins despite pullbacks in consumer spending, because it can go toe-to-toe on price with just about any brick-and-mortar retailer or e-commerce platform. Additionally, Walmart has built out other shopping options, like pickup, delivery through Walmart+, and more.

Similarly, Costco can afford to pass along value to customers on merchandise sales because it generates steady cash flow from annual membership rates. Costco makes the majority of its net income from membership fees, and profits very little from merchandise sales. Customers are incentivized to shop at Costco as much as possible to justify the membership, and Costco gives them good deals in return. Costco could charge more and boost near-term profits, but management is laser-focused on the brand's strength and long-term customer loyalty.

Priced to perfection

Walmart and Costco are undeniably better businesses than Dollar General and Dollar Tree, but their valuations have reached sky-high levels. Even on a forward price-to-earnings (P/E) ratio basis, Costco and Walmart sport more expensive valuations than all of the "Magnificent Seven" stocks (except Tesla), whereas Dollar General and Dollar Tree have forward P/E ratios under 20.

COST PE Ratio (Forward) Chart

COST PE Ratio (Forward) data by YCharts.

Over the long term, quality is more important than present-day valuation, because a company that consistently improves earnings can grow into its valuation. But if a company's stock price keeps increasing faster than its earnings rise, its valuation will remain inflated. This dynamic has been at play with Walmart and Costco, which have seen their P/E ratios balloon far above their historical averages due to their stock prices outpacing earnings growth.

What's more, both stocks no longer have serviceable dividend yields because their stock prices have outpaced their dividend growth rates. Walmart yields just 0.9% and Costco yields 0.5%. Dollar General sports a decent yield of 2.1%, and Dollar Tree has never paid a dividend. Granted, Costco occasionally pays special dividends when its cash on the balance sheet reaches a comfortable level. But even during special dividend years, like in 2024 and 2020, Costco still only yields around 2% to 3%.

The better buy now

If I had to pick, I'd go with a 50/50 split of Dollar General and Dollar Tree over Walmart and Costco simply because their valuations are so much lower, and Walmart and Costco aren't growing quickly enough to justify their high valuations. At that valuation level, investors are arguably better off buying a top growth stock like Microsoft, which is expanding margins and consistently generating strong revenue growth.

Walmart and Costco are phenomenal companies, but a great company isn't always worth investing in if its valuation is at nose-bleed levels -- especially when faster-growing alternatives are available at reasonable multiples.