Warren Buffett recently made headlines for his donation of about $2.8 billion in the form of Berkshire Hathaway stock to the Bill and Melinda Gates Foundation and several other charities.

The latest gift in Buffett's annual pledge to give away the majority of his wealth was the largest single charitable donation in history and makes Buffett the second most philanthropic person on the planet (by value of donations), with only Gates himself having given away more money.

However, if Berkshire Hathaway continues its track record of excellent performance, the latest gift could be just the beginning. Let's take a look at how big Buffett's gifts could get simply by using the principle of investing that created most of Buffett's fortune: Compounding investment returns over long periods of time.

The pledge
Buffett is one of the founding signers of The Giving Pledge, a commitment by ultra-wealthy people to give away at least half of their wealth. The pledge was made official in 2010, but Buffett had committed to giving away the vast majority of his money several years before, in 2006.

For the bulk of his donation, Buffett pledged 10 million class-B shares of Berkshire Hathaway stock to be given to the Bill and Melinda Gates Foundation in annual increments. The class B shares have since undergone a 50-to-1 split, so his total gift would be the equivalent of 500 million of today's class B shares, worth about $31 billion at the time of the gift.

However, due to Berkshire's excellent performance, the value of Buffett's pledge has more than doubled to over $64 billion today.

In order to ensure the gifts last for a long, long time, each year the foundation receives 5% of the remaining shares from Buffett's committment. So, during the first year, the foundation received 5% of the full 10 million, or 50,000 shares. The following year, the donation would have been 5% of the remaining 950,000 shares, or 47,500.

Buffett converts his shares to class-B shares (which carry less voting rights) before donating, and for 2014 the foundation received about 16.6 million class B shares worth more than $2.2 billion.

So, the value of the gift is fully dependent on how Berkshire's stock is doing. So, even though the number of shares donated goes down every year, the total value of the shares could easily increase if Berkshire continues to do well.

Future gifts and Berkshire's performance
Based on the shares the foundation received this year, it's fairly easy to predict how many it will receive in the coming years. Next year's gift should be about 15.8 million shares, then another 15 million in 2016, and so on.

Berkshire's share price has grown annually by about 20% on average since 1964 when Buffett took over. So, based on that, the donations will have no problem increasing in value over time, even as the number of shares in each donation falls.

So, if Berkshire keeps up its historic track record of performance, some of its gifts could get pretty large over the next few decades. Click through the graphic below to see the potential of future Buffett donations to the Gates' foundation.

Warren Buffet Donations to Bill & Melinda Gates Foundation (2015-2050) | Create Infographics

Of course, in some years, the performance will be better than others, but over any economic cycle, Berkshire tends to perform very well . Take a look at the first page of Berkshire's most recent shareholder letter, and compare Berkshire's performance to that of the S&P 500 over any 10 or 20 year period of time. For example, notice that over the past 10 years, Berkshire failed to outperform the S&P in five years. However, thanks to the company's excellent performance during the financial crisis, Berkshire actually delivered nearly 70% higher returns than the S&P during that time.

So, I'm fairly confident that the donations could start to get quite large over the years.

The legacy of Warren Buffett
As a man who made more than 99% of his wealth after his 50th birthday, Warren Buffett loves using compound returns over time to his advantage.

As a final thought, consider that if Berkshire continues its excellent performance, the next 35 years of donations to the Gates' foundation could add up to nearly two trillion dollars.

It seems like his own personal wealth might have been just a starting point for Warren Buffett's impact on the world. Using his favorite principal of investing, some of the gifts that will be given to the world after he's gone could make his current wealth seem like just an opening act.

Matthew Frankel has no position in any stocks mentioned. The Motley Fool recommends Berkshire Hathaway. The Motley Fool owns shares of Berkshire Hathaway. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.