Kroos, 24, was instrumental in Germany's World Cup triumph and leaves the German Bundesliga champions with a year still left on his contract.
He signed a six-year deal with the Spanish club. The midfielder will be presented by the club at 5pm today at the Bernabeu, Real Madrid said in a statement.
"We thank Toni Kroos for his time in Munich," Karl-Heinz Rummenigge, chairman of Bayern Munich said. "We have achieved great success with him here. We wish him and his family all the best in Madrid and at Real."
Bayern said the clubs had agreed to not disclose the transfer fee, but according to media reports the midfielder went for €30 million.
PHOTO GALLERY: World Cup winners welcomed home
The transfer to Spain of one of the brightest stars in German football had been in the offing for a while.
After winning the World Cup, he exclaimed: "We’ve finished the World Cup in the best way possible. Now I’m going to Madrid, so that’s two dreams achieved."
He is expected to sign a deal that will earn him €12m per season.
At Madrid, he has the mouth-watering prospect of being the creative midfield brain tasked with launching attacks behind a front-line of Karim Benzema, Cristiano Ronaldo and Gareth Bale, with rumours also suggesting fellow World Cup star James Rodriguez could move to Madrid.
Kroos could also link up with his countryman and fellow World Cup winner Sami Khedira in Spain, but Khedira is rumoured to be heading to London club, Arsenal.
He won the Champions League with Bayern Munich in 2013 as well as the Bundesliga and German Cup titles for the last two seasons.
SEE ALSO: Where now for Germany's World Cup stars?