After giving away $28 billion, Bill Gates is no longer the third-richest man in the world.

He's the second-richest.

You read that right. Despite his considerable, praiseworthy charity work, the Microsoft cofounder is getting wealthier.

In 2012, he wound up $7 billion ahead with a net worth of $63.4 billion, according to Bloomberg's Billionaires Index published today.

That's not to say that he isn't giving a lot of money away. He is. The Bill and Melinda Gates Foundation is working with a $36.2 billion endowment, most of it from Gates.

But lately he's been earning money faster than he can give it away.

His wealth in 2012 was helped by a 2% rise in Microsoft's stock price. But he's been slowly selling off chunks of his Microsoft stake. Microsoft stock now accounts for less than 20 percent of his fortune.

So if his wealth isn't just from Microsoft, where does Bill Gates invest? He's got a somewhat secretive investment company called Cascade Investment, according to documents filed with the SEC. From those filings we know that Gates owns stakes in companies like tractor maker Deere & Co; garbage collector Republic Services; soft drink maker Coca-Cola; and auto retailer Auto Nation, among others.

Don't miss: The 10 Billionaires Whose Net Worth Rose The Most In 2012