$5,000 might not seem like enough to invest in the stock market. However, $5,000 put in the right stock could blossom to more than $1 million over a few decades. Let's take a closer look at three of the most well-known examples from the tech industry -- Apple (AAPL 1.27%), Microsoft (MSFT -0.51%), and Cisco (CSCO 1.61%).

Image source: Getty Images. 

Apple

Apple went public in 1980 at $22 per share. $5,000 would have been enough to buy 227 shares. After four splits, you would now own 12,712 shares, which would be worth roughly $1.3 million. Moreover, that position would be paying out nearly $29,000 in dividends per year.

Apple's early years, which mainly relied on Apple II and Mac sales, were rocky. Co-founder Steve Jobs left his own company after a dispute with the board in 1985, and its products were subsequently crushed by Microsoft's rapidly growing market share across IBM PC clones.

Apple's growth didn't get back on track until an older and wiser Jobs returned to Apple in 1997. With a renewed focus on sleek hardware and end-to-end control of its ecosystem, Jobs' Apple launched the iMac, iPod, iPhone, and iPad -- all hit products which redefined their respective industries. Between 1997 and 2011 -- the year Jobs resigned and passed away -- Apple's annual revenue rose from $7.1 billion to $108.2 billion. That figure hit $215.6 billion in fiscal 2016.

Microsoft

Microsoft went public for $21 per share in 1986. $5,000 would be enough to buy 238 shares. After nine splits, you would own 34,272 shares, which would be worth $1.99 million. You would also be earning over $53,000 in dividends per year.

Microsoft's core business was built on providing an easy-to-use OS for IBM-compatible PC clones throughout the 1980s and 1990s. That product, Windows, quickly became a unifying OS for the fragmented hardware market, and gave Microsoft a firm foundation to launch additional products like Office and Internet Explorer. Between 1997 and 2007, the year the first iPhone was introduced, Microsoft's annual revenue rose from $8.7 billion to $51.1 billion.

However, Microsoft missed the crucial technological shift toward mobile devices, where it fell woefully behind Apple and Google. The fragmentation of the Windows and Office markets, caused by users who didn't upgrade their "good enough" software, then throttled the tech giant's top line growth. Today's Microsoft is still struggling to grow its top line, but its aggressive shift toward mobile-first, cloud-first solutions with the universal Windows Store, Azure, Cortana, and Bing are gradually getting the company back on track.

Image source: Microsoft.

Cisco

Cisco went public for $18 per share in 1990. You could have bought 277 shares, which would have been split 9 times into 79,776 shares. That position would be worth nearly $2.5 million today, and be paying out $83,000 in annual dividends.

Cisco was a darling of the dot-com boom, surging to a split-adjusted $79 per share in March 2000. Investors, seemingly enamored with the notion that the networking company's routers and switches would link up everything in the world, bid the stock's P/E ratio up to over 200 by the end of 2000.

That ratio proved unsustainable for Cisco, which only grew its net income by 35% in 2000, and the stock plunged to about $12 the following year. Since then, Cisco has evolved into a mature tech stock which is owned for income instead of explosive growth. With its core markets routers and switch markets being heavily commoditized, Cisco has pivoted toward higher-growth markets like cybersecurity, service provider video, and collaboration solutions in recent years.

The key takeaway

Past performance never guarantees future returns, but the growth stories of Apple, Microsoft, and Cisco show just how much patience pays off. If you had sold these stocks after they doubled or tripled, you would have missed out on the massive gains that came decades later. Therefore, never underestimate the potential of a seemingly small $5,000 investment to eventually make you a millionaire.