Elon Musk's donation of some five million Tesla shares to unspecified charities is expected to reduce his 2021 tax bill.

Tesla Chief Executive Elon Musk, considered the richest person in the world, has donated 5.04 million shares of his company to unspecified charities, according to a securities filing.

Musk gave away the stock in November 2021 in five separate transactions, according to a filing released Monday night by the US Securities and Exchange Commission (SEC).

The donations were worth about $5.7 billion at the time they were made, but are now valued at around $4.4 billion following a pullback in shares of the electric car company.

The transactions came as Musk was selling a huge quantity of Tesla shares granted to him as compensation. Musk's stock sales were expected to generate a large tax bill that could help to mitigate.

Musk sold more than $16 billion worth of Tesla shares in late 2021, according to the Wall Street Journal.

Musk said on Twitter in December that he expected to pay $11 billion in taxes in 2021.

The outspoken executive, whose fortune is estimated at $238 billion by Forbes, has criticized a wealth tax backed by progressives lawmakers in the US Congress such as senators Bernie Sanders and Elizabeth Warren.

But Musk in 2012 signed the "Giving Pledge," which was launched by Warren Buffett and Bill Gates and encourages the rich to contribute a majority of their wealth to philanthropic causes.