Microsoft (NASDAQ:MSFT) is well known for its Windows and Office software. Its software is so widely used that Microsoft is one of the few companies to have reached a market capitalization of $1 trillion.

The brand wasn't quite so ubiquitous 33 years ago. When Microsoft first sold shares to the public in 1986, the market cap was less than $700 million. That would make it a small-cap stock by today's standards.

Obviously, Microsoft stock has created tremendous wealth for investors over the years. Let's look at how much a $5,000 investment would be worth today if you had bought the stock at the initial public offering (IPO) price.

A man, dressed in casual clothes and wearing sunglasses, sweeps dollar bills out of his hand.

Image source: Getty Images.

Patience and the right stock can lead to incredible results

Microsoft had its IPO on Mar. 13, 1986. The original trading price was $21. The stock split nine times over the years, with two of those being 3-for-2 splits. (A quick note about how splits work: In a typical 2-for-1 split, shareholders receive two shares for every one share they own. The stock price is then adjusted proportionally so that the value of the investment remains the same as before the split.)

If you had bought just one share of Microsoft at the IPO, you would now have 288 shares after all the splits. Those shares would be worth $44,505 at the current stock quote of $154.53.

A $5,000 investment would have purchased 238 shares at the IPO price. After the splits, you would now own 68,544 shares. Those shares would be worth $10,592,104. That's a compound annual return of about 25% per year, or a cumulative return of nearly 211,000%.

The dividends you would be earning every year are just as awesome. Microsoft paid its first quarterly dividend in 2004. The current payout is $0.51 per share each quarter. If you hadn't succumbed to the temptation to cash in your shares too early (as some of us do), you would be earning $34,957 in income every quarter, or $139,830 every year.

How Microsoft did it

Microsoft has been a phenomenal growth story. Its success was cemented well before its IPO, back in the very early days after Bill Gates founded the company in 1975. In those early years, Microsoft's future success was all but guaranteed, based on its growing relationship with Intel and IBM.

In the 1970s, Microsoft was building its software to work well with Intel's 8086 microprocessor. In 1980, Microsoft made a deal to supply an operating system, known as DOS, for IBM's new PCs. As fortune would have it, the relationship that Microsoft founder Bill Gates was forming with IBM and Intel was an important factor that would eventually make Microsoft one of the most dominant tech companies in the world.

When IBM selected Intel's chip design to be used in its groundbreaking 5150 PC in 1981, Microsoft's relationship with these two tech companies was cemented. Microsoft's software quickly became familiar to business buyers of IBM's computers during the 1980s, which paved the way for tremendous growth during the rapid adoption of the PC in the 1990s.

Over the past four quarters, Microsoft has generated $130 billion of revenue. Where does it go from here?

The software giant is still growing at a good clip as management guides it into a new era of subscription-based products and cloud services. Last quarter, revenue and earnings increased by 14% and 21% year over year, respectively. Those are impressive growth rates for such a large company.

Microsoft stock has been surging to new highs lately and is up 52% year to date. And there is still upside for the long term, especially as Microsoft's Azure cloud business continues to outpace the competition. In October, the U.S. Department of Defense awarded a $10 billion contract to Microsoft, which is a huge win for Azure as it continues to chip away at the lead of Amazon Web Services in the cloud market.

Even if you missed the opportunity to invest 30 years ago, Microsoft still looks like a solid growth stock to anchor any investor's portfolio.