Target walmart online shopping wars and Between the COVID-19 pandemic, decades of high inflation, and unprecedented tariffs, it’s been a turbulent five years for retail.

Some big chains have weathered these challenges better than others, as Walmart and Target highlighted in their quarterly earnings this week. Walmart reported a 4.8% increase in sales at its U.S. stores that have been open at least a year, even as profits were down. Target saw its sales decline for the third straight quarter due to a CEO change.

Target and Walmart are among the largest department stores in the U.S., but Walmart has a clear advantage in the competition among big retailers. Target’s problems stem from years of poor decisions, from a surplus of household goods during the pandemic to the scaling back of its diversity, equity, and inclusion initiatives earlier this year.

Walmart, on the other hand, has positioned itself better over the past decade to compete with online shopping powerhouses—from Amazon to TikTok. This is crucial because online shopping is growing faster than brick-and-mortar stores, even though more money is still spent in brick-and-mortar stores, according to a report by Capital One Shopping Research.

Walmart “could essentially reach 95 percent of the country in three hours or less and sell products to consumers at the same price they would pay in their stores,” Bradley Thomas, managing director of Consumer and Retail Hardlines at KeyBanc Capital Markets, told CNN in an interview.

Walmart’s larger footprint and focus on affordable staples also make it a more attractive option for shoppers.

“It’s not easy to suddenly convert half a store to grocery, and it’s not going to happen overnight,” Brad Jashinsky, an analyst at research firm Gartner, told CNN. “And that’s partly because Amazon and Walmart have done very well, while Target has faltered in some areas.”

The Online Gap Between Walmart and Target

The digital divide between the two retailers has widened: Walmart’s global e-commerce business grew 25% in the second quarter, while Target’s comparable digital sales grew 4.3% during the same period, according to the companies’ earnings reports this week.

While Amazon leads by a wide margin with 40.6% of U.S. sales, Walmart is in second place with 9.4%, according to market research firm eMarketer. Target accounts for just 1.6%, behind Home Depot, Temu, eBay and Apple, as well as Walmart and Amazon.