The 26-year-old goalkeeper will sign a six-year deal at Madrid subject to passing a medical and agreeing personal terms.
Croatia international Mateo Kovacic will be on a season-long loan at Stamford Bridge as part of the deal.
“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,” the Premier League club said on Wednesday.
“Subject to the completion of the deal Mateo Kovacic will join the Blues on a season-long loan.”
Madrid have been keen to bring in Courtois in a €35m deal (£31m/$40m).
Chelsea will kick off their Premier League campaign on Saturday with an away trip to Huddersfield Town.