Image source: Getty Images.

The past decade hasn't been kind to retailers. Since the Great Recession, Amazon.com has taken a bigger and bigger slice of the merchandise pie, while brick-and-mortar players like Wal-Mart (WMT -0.08%) and Target (TGT 0.18%) have seen their physical locations transform from assets to liabilities.

All is not lost: Both companies remain solidly profitable and offer up significant and healthy dividends. But between Wal-Mart and Target, which is the better buy today?

There's no definitive way to answer the question. But we can look at the two through three different lenses to get a feel for where they stand.

Financial fortitude

Investors often underappreciate the value of cash. While returning it to shareholders is more satisfying, keeping a substantial chunk of cash on hand is crucial for long-term survival, especially in retail. When you have cash, you have options in tough times -- you can outspend rivals, buy back shares on the cheap, and even make acquisitions.

Debt does the opposite -- forcing you to limit your focus, potentially supply the market with more shares, and face the possibility of going bankrupt. Here's how Wal-Mart and Target stack up. It's important to note that Wal-Mart's $228 billion market cap is five times the size of Target's.

Company

Cash

Debt

Net Income

Free Cash Flow

Wal-Mart

$7.6 billion

$50.6 billion

$14.4 billion

$17.7 billion

Target

$4.0 billion

$14.2 billion

$3.4 billion

$3.1 billion

Data source: Yahoo! Finance. Net income and free cash flow are on a trailing twelve-month basis.

While neither company has a debt or cash position to get excited about, both companies produce enough free cash flow to easily meet all of their debt obligations.

But given that Target is valued at just one-fifth the size of Wal-Mart, its cash and debt positions are more advantageous than Wal-Mart's. While not a runaway winner, this tips the scales in Target's favor.

Winner: Target.

Sustainable competitive advantages

Over a long enough time frame, no variable has a greater effect on the success of a company than its sustainable competitive advantages. Without them, competition eventually erodes the business until it becomes a simple commodity.

Sadly for both of these companies, sustainable competitive advantages are hard to come by. In the past, Wal-Mart had unmatched pricing power. Today, more and more customers are doing their shopping from home, which means both Wal-Mart and Target are facing significant headwinds.

In my opinion, neither of these two have moats worth writing home about, so they'll end in a tie.

Winner: Tie.

Valuation

Finally, we come to probably the most difficult answer to pin down: How expensive is each stock? Here are four different ways to evaluate this.

Company

P/E

P/FCF

P/S

PEG Ratio

Wal-Mart

16

13

0.47

5.2

Target

16

14

0.62

1.45

Data sources: Yahoo! Finance, YCharts, E*Trade. P/E = price to earnings; P/FCF = price to free cash flow; P/S = price to sales; PEG = price/earnings to growth.

On almost every metric, these two look equally valued -- though analysts clearly think Wal-Mart is facing more challenges in the future, given its elevated PEG ratio.

Another variable worth considering is each company's dividend. Wal-Mart currently yields 2.7% while using 40% of its free cash flow to pay shareholders. Target, on the other hand, yields 3.2% while using 44% of its free cash flow to do so.

Both of these dividends are healthy, but Target's is clearly more enticing. When we combine this with Wal-Mart's elevated PEG ratio, Target once again comes out on top.

Winner: Target.

I'm not excited about either

Between these two, Target comes out ahead. But I would caution any investor about investing in these companies over the long haul. E-commerce is killing middle-of-the-road retailers like Wal-Mart and Target. Lower-end stores like Dollar General will likely continue to be prevalent, as well as high-end purveyors like Giorgio Armani, where clients simply like the shopping experience. But for convenience, Middle America is flocking to e-commerce.

The result is that these companies are looking to fundamentally change the way they do business -- and that is a very difficult thing to do.