The Beginner’s Guide to Investing

If you invested $1,000 in Microsoft and Apple at IPO, this one would have made you 4 times as rich

If you had invested in either Apple or Microsoft at the time of its initial public offering, or IPO, your gamble would have paid off big time. But one of these tech heavyweights would have earned you significantly more than the other.

A $1,000 investment in Apple on the day of its IPO on December 12, 1980, would be worth more than $425,000 today, according to CNBC calculations. However, a $1,000 investment in Microsoft on the day of its IPO on March 13, 1986, would be worth more than $1.7 million, or around four times more.

Those figures include price appreciation and dividends. Returns also account for stock splits and other corporate events.

While both Apple and Microsoft stock have performed well, any individual stock can over- or under-perform and past returns do not predict future results.

For decades, Microsoft dominated the tech industry

Microsoft dominated the tech industry throughout the 80s and 90s and was successful long before 1986. Although Microsoft was founded in 1975, the company waited 11 years before going public, primarily because CEO and co-founder Bill Gates wanted to retain as much control of the company as possible. It helped that Microsoft was so profitable that it didn't need outside money in order to grow.

The eventual IPO was an immediate success. It opened at a price of $21 per share, but "the first trade took place at $25.50 a share, an indication of the fierce demand for the stock," the Seattle Post-Intelligencer reported at the time.

Microsoft's stock prices as of December 5, 2018 at 10:05 a.m. ET. Click to enlarge

Microsoft continued to lead the way in the software world. On the heels of the release of Windows 2.0 in 1987, it became the largest software company in the world by sales.

Over the next few decades, Microsoft continued to innovate and expand its scope. One of its most successful releases came in the in the mid-90s with the introduction of Windows 95. Microsoft sold an astounding 40 million copies in its first year. In 2001, the company introduced the Xbox, which was also an immediate hit and sold 1.5 million units in less than two months. The console grounded Microsoft in the video game space, and that became one of its most profitable divisions.

Microsoft's popularity began to wane in the early 2000s as it released a string of unpopular products and failed to keep up with modern trends but, when Satya Nadella took over as CEO in 2014, he oversaw a major turnaround.

Nadella embraced cloud computing and helped Microsoft emerge as a top competitor in the space. He also helped the company expand its reach through the acquisitions of professional networking site LinkedIn in 2016 and code-sharing service GitHub in 2018.

Since Nadella took over, Microsoft's share price has nearly tripled. In November, it dethroned Apple as the most valuable public company in the world, with a market cap of more than $850 billion. If Microsoft holds onto the spot through the end of the year, it will mark the first time since 2002 that the company closes out in the top position.

Apple fumbled, then emerged as a fierce competitor

Founded in 1976, Apple went public four years later in December 1980, an event the Wall Street Journal described as "one of the most eagerly awaited in recent years."

Apple's 4.6 million shares went for $22 each and sold out "almost immediately," EDN reports. The stock rose more than 30 percent that day and closed at $29 per share.

Apple's stock prices as of December 5, 2018 at 10:10 a.m. ET. Click to enlarge

However, despite its early success, Apple struggled through much of the 1980s and 90s. In 1985, the company ousted its famously volatile co-founder Steve Jobs and began to falter in the market. It fell behind its competitors, including Microsoft, thanks to a string of failed products and turnover at the top.

By 1997, Apple was on the brink of bankruptcy and forced to lay off a third of its workers. As a last-ditch effort, it rehired Jobs and named him interim CEO. Jobs vetoed the majority of Apple's production plans at the time and implemented a new focus on simplicity.

Under his leadership, the company released the iMac G3 in 1998, which brought Apple back to prominence. Jobs followed that with the release of the iPod in 2001 and the iPhone in 2007. The iPhone quickly became a top seller and revolutionized how customers use technology.

Today, Apple is a force to be reckoned with: In August, the technology giant became the first public U.S. company to reach a $1 trillion market cap after the stock briefly hit $207.05 per share. The surge allowed the software company to reach that milestone ahead of e-commerce giant Amazon.

Like this story? Subscribe to CNBC Make It on YouTube!

Don't miss: Here's the first thing Bill Gates did with his money after making over $350 million from Microsoft's IPO