Home improvement retail giant Home Depot (HD -1.44%) is one of the greatest stocks of all time. A $10,000 investment in the company's initial public offering (IPO) in 1981 would be worth more than $230 million today. Now worth more than $300 billion, Home Depot is probably too big to replicate those returns.

However, Home Depot still has plenty of opportunities to help you generate enough wealth to retire comfortably. I will show you why Home Depot could still help you walk into your golden years as a millionaire.

Housing market domination

Home Depot boasts roughly 2,000 stores in the United States, plus stores in Canada and Mexico. For most, their home is the largest and most emotional purchase in their life; it's the "American Dream," and there's nearly endless work for homeowners, from maintenance to upgrades. These things all cost money and make housing a very lucrative industry.

Person shopping in a home improvement store.

Image source: Getty Images.

While the average homeowner is an important customer for Home Depot, it does a ton of business with professionals, selling to contractors and homebuilders. Its size and supply chain advantages help the company sell at competitive prices. Home Depot benefits from money flowing into the housing market, selling the supplies to renovate old homes or build new ones.

Management estimates that its total opportunity in North America is worth $900 billion, and the company already owns about 17% of that. Whether it's taking business from smaller competitors or growing new business segments like contracted services (having Home Depot install your carpet, for example), there's room for the company to keep growing despite its massive size.

Diving into the numbers behind stellar returns

The long-term formula for a great business is simple: Grow profitably for many years, and your company will thrive. It's usually easier said than done, but Home Depot has proven very good at it. You can see in the chart below how its revenue has steadily grown for decades; even the worst housing crisis in generations (2008 to 2009) is just a "blip" in the long run.

HD Revenue (TTM) Chart

HD Revenue (TTM) data by YCharts.

But the company's ability to generate free cash flow and cash profits from the business is most impressive. Retail is a ruthlessly competitive industry, so Home Depot's ability to create almost $0.10 of cash from every revenue dollar is fantastic. Walmart, the "king" of retail, generates just $0.02 to $0.04 of free cash flow per sales dollar in a given year!

Home Depot does more than $150 billion in annual sales, creating billions of dollars in free cash flow. Management has used this cash to aggressively repurchase shares, lowering the share count by 32% over the past decade, as seen in the below chart.

HD Free Cash Flow Chart

HD Free Cash Flow data by YCharts.

Share repurchases increase per-share metrics like earnings-per-share (EPS). Home Depot's total earnings grew an average of 15% annually over the past decade, but EPS grew even faster at 20% annually because of the share repurchases.

If a company can grow at a healthy rate and super-charge that growth with repurchases, it can create significant investment returns over time, precisely what Home Depot's done.

Gaining millionaire status

Your financial situation is unique to you, so how quickly Home Depot can help you retire will depend. However, here is some help with figuring that out. The hot housing market has helped Home Depot grow in recent years, and analysts believe that could slow down. After growing EPS an average of 20% over the past decade, analysts estimate EPS will grow 10% annually for the next three to five years. If you factor in Home Depot's 2.5% dividend yield, investors are looking at total returns of 12% per year, which I think is very achievable, given the company's success and a still-hot housing market.

Mathematically, this rate of return would double your investment every six years. You can use this information and apply it to your situation. For example, if you invest $10,000 into Home Depot today, that would (hypothetically) grow to $40,000 over 12 years. Your investment can be smaller, especially if you have a longer wait before retirement, and will need to be more significant if you're closer to retirement.

Investors should remember that no stock is a "sure bet." Still, Home Depot is about as entrenched in its industry as any company, and its rinse-and-repeat record of steady growth and share repurchases have produced tremendous results. If it's not broke, don't fix it, and I think Home Depot can still play a significant role in helping you retire wealthy, even if it's too big to make you filthy rich anymore.