The Brazilian playmaker had one year left on his contract with the Rossoneri but exercised a get-out clause to end the agreement after Milan's failure to qualify for European football next season.
A statement from Milan read: "AC Milan announces it has mutually terminated the contract of Kaka today."
The 32-year-old has been strongly linked with a move to Major League Soccer in recent months and is expected to sign a contract with Orlando City.
However, Kaka is set to play on loan for six months at Sao Paulo, where he started his career in 2001, before the MLS season begins.
Kaka only returned to the San Siro on a free transfer last summer after four years at Real Madrid.
The 32-year-old, who won a Serie A title and the Champions League in his first spell at Milan, scored seven goals in 30 league appearances in the 2013-14 season.
In total, Kaka, FIFA World Player of the Year in 2007, has scored 104 goals in 307 appearances for the Rossoneri.
Milan's statement continued: "Certain loves never end, they go in big circles when a contract is mutually terminated.
"The key word is mutual.
"Ciao Ricky (Kaka), we will never leave each other."
Milan finished a disappointing eighth last season and failed to qualify for European competition for the first time in 16 years.
That City fan who bought a shirt with his name across the back must be crossing his fingers and toes now.- solskjaer99