The 26-year-old Courtois previously played for Atletico Madrid on loan from Chelsea for three years between 2011-14 and wanted to return to the Spanish capital, where his children live
Real Madrid have signed Belgian goalkeeper Thibaut Courtois from Chelsea with Croatia midfielder Mateo Kovacic going the other way on loan, the clubs said on Wednesday.
Courtois has agreed a six-year contract and Real will pay an initial 35 million euros ($40.7 million) for the Belgian goalkeeper, Spanish media reported.
"The Golden Glove (winner) from the last World Cup signs for the Champions League champions after his impressive performance in Russia," Real Madrid said in a statement.
"After his medical on Thursday August 9, the player will be presented in the presidential box at the Santiago Bernabeu."
The 26-year-old previously played for Atletico Madrid on loan from Chelsea for three years between 2011-14 and wanted to return to the Spanish capital, where his children live.
"I would like to express my heartfelt gratitude for the four fantastic years that have passed. Chelsea FC will always have a fantastic place in my heart," Courtois said on Facebook.
"I want to thank the fans for their great support over the years. I hope you understand that being closer to my kids was considerable in my decision."
Courtois played 154 times for Chelsea after arriving at Stamford Bridge in 2011, keeping 58 clean sheets.
British media reported that the Belgian, who has played 65 times for his country and helped them reach this year's World Cup semi-finals, has not shown up for training at Chelsea for the past two days in a bid to force through the transfer.
"Chelsea and Real Madrid have tonight agreed terms for the permanent transfer of Thibaut Courtois subject to the agreement of personal terms and passing a medical," Chelsea said in a statement.
Courtois is set to take over as Julen Lopetegui's first- choice goalkeeper at the Santiago Bernabeu, with Keylor Navas and Kiko Casilla likely to be demoted.
Madrid have attempted to replace Navas in each of the previous two close seasons, despite the Costa Rican helping them win three Champions League titles in three years.
Chelsea have completed the signing of Athletic Bilbao goalkeeper Kepa Arrizabalaga for a world record 80 million euros and the 23-year-old Spaniard has signed a seven-year contract.
Thibaut Courtois is heading to Real Madrid. Kepa Arrizabalaga will replace him at Stamford Bridge. pic.twitter.com/nht7YlBkRx— ESPN FC (@ESPNFC) August 8, 2018
"It's a very important decision for me, for my career and also for my personal life," Arrizabalaga said. "I'm very glad Chelsea has decided to trust me and to take me in as well."
The Spaniard becomes the most expensive goalkeeper in football history, replacing Brazilian Alisson who completed a 75 million-euro move to Liverpool last month from AS Roma.
Kovacic, 24, will compete for places in Chelsea's midfield under new manager Maurizio Sarri alongside Frenchman N'Golo Kante, Italian Jorginho and Spaniard Cesc Fabregas. ($1 = 0.8610 euros)