Retailers Walmart (WMT 0.04%) and Macy's (M 0.95%) have their work cut out for them as they struggle to cope with the Amazon (AMZN 0.18%) effect of more people shopping online and expecting top-notch convenience. 

It's tempting to think Amazon is taking over all of retail, but Walmart and Macy's are fighting back. While Walmart has taken to some exciting acquisitions and to bolstering its online presence, Macy's has been focusing on selling empty properties. Walmart stock rose 43% last year while Macy's dropped 30%, but does that mean Walmart is the better buy? Let's take a closer look. 

A Walmart employee helps a customer in the baby section

Walmart has fought back hard against Amazon. Image source: Walmart.

Financial strength and growth

Both Walmart and Macy's are in the battle of their lives to stay in the e-commerce game. Competition has been fierce, prompting big players to bump up their M&A activity, such as with the acquisition of Jet.com by Walmart in late 2016. 

In the months since the Jet.com purchase, Walmart has acquired a number of online retailers, including ModCloth, Bonobos, and Moosejaw. Then in October 2017, Walmart purchased Brooklyn-based express delivery service Parcel to help it offer speedier delivery. These purchases have given Walmart a sizable advantage over Macy's, which has been quiet on the M&A scene. 

In the 12 months ending Oct. 31, 2017, Walmart notched $495 billion in total revenue. Revenue in the final quarter of that period was 4.2% larger than in the year-ago period. Walmart is growing and leaning into the new age of e-commerce, and it shows. Meanwhile, in the 12 months ending Oct. 28, 2017, Macy's notched $24.7 billion in revenue. Sales in the final quarter of that period were down 6.1% from the year-ago period. That decline reflected the closing of stores.

 Metric
 Walmart  Macy's
 Revenue
 $495 billion  $24.7 billion
 Net income
 $11.4 billion  $697 million 
 Levered Free cash flow
 $17.8 billion  $1.8 billion
 Cash and equivalents  $7.0 billion  $534 million
 Long-term debt  $34.6 billion  $6.3 billion

Data source: Capital IQ. Numbers from 12 months ending Oct. 31, 2017.

While Walmart has over five times more debt than Macy's, it crushes Macy's in every other category in that table. Walmart's revenue is more than 20 times Macy's revenue, and its net income is about 16 times Macy's net income. Furthermore, Walmart has $16 billion more in levered free cash flow and $6.5 billion more in cash and equivalents. 

The chart below gives a better visualization of Walmart vs. Macy's. Even with the heightened M&A activity, Walmart is growing its revenue, and its cash from operations is heading up. Meanwhile, Macy's cash from operations has plummeted, and its revenue is still on a downward trend.  

M Cash from Operations (TTM) Chart

M Cash from Operations (TTM) data by YCharts.

Valuation and stock performance

As of this writing, Walmart's stock is up an incredible 48% in the past year as investors have welcomed its aggressive moves into e-commerce.

By now, you can probably guess how Macy's stock is performing. Shares of the retailer are down 23% in the past year. In the first month of 2018, Macy's shares got a slight boost, partly due to Macy's revising its full-year earnings per share guidance slightly upward after a better-than-expected November-December holiday period.

Macy's is a seemingly cheap stock with a forward P/E of 8.9. However, Walmart's forward multiple of 22.2 compares favorably with the average retail forward P/E, which is 19.62 as of January, according to analysis by NYU Stern School of Business. And Walmart has the more solid balance sheet. 

While P/E isn't the only metric investors should look at, it's important to remember that Macy's is also struggling to come up with other revenue streams. Some think Macy's earnings aren't sustainable in the long term since they include the sales of its empty real estate properties. In the latest quarter, Macy's got a boost from $65 million of asset sales, and that strategy is expected to continue throughout 2018. 

The winner

The choice is clear for me. Walmart has been aggressive with buying strength in the e-commerce space, and could announce some exciting updates in relation to its purchase of Parcel that could help it better compete with Amazon's fast shipping. I can see that a turnaround is happening and that the company is in fighting mode. 

On the other hand, Macy's has been relying heavily on selling old properties rather than investing in exciting tools or companies that can help propel it into the e-commerce age and out of the mall era. Walmart is the better buy.