0737 GMT January 25, 2020
"Thank you Iker, for everything," Real said on its website on Saturday, Reuters reported.
"Thank you for being a symbol of the best in our history. You are leaving but we will not forget that you belong in Real Madrid's heart forever."
Casillas, 34, became a hero for club and country during a glittering career, when he won titles including three Champions Leagues with Real and the World Cup and two European Championship trophies with Spain.
But in recent years he lost some of the sheen that earned him the nickname 'Saint Iker' and last term was regularly whistled by disgruntled fans at the Bernabeu as the world's richest club ended the campaign without major silverware.
The expected arrival of Manchester United's David De Gea, the 24-year-old former Atletico Madrid man who is being groomed to take over as Spain keeper, will also have contributed to Casillas's decision to move on.
Regular playing time for Porto, coached by Spaniard Julen Lopetegui, should allow Casillas to extend his international career at least until next year's European Championship in France.
Casillas made his debut for Real in September 1999, aged 18, and as well as three European crowns he has also won five La Liga titles, two King's Cups and one Club World Cup.
"Thank you Iker, for everything," Real said on its website. "Thank you for being a symbol of the best in our history. You are leaving but we will not forget that you belong in Real Madrid's heart forever."