"It is now time to respect his decision and show our appreciation for his professionalism, dedication and passion all these years," Real Madrid said in a statement on its website.
"Zidane is one of Real Madrid's great myths and his legend beyond his role as coach and player at our club."
The Frenchman's departure comes at the end of a disappointing campaign for the 13-time European champions, who also lost to Chelsea in the Champions League semi-finals as they failed to win a trophy for the first time in 11 seasons.
Only 10 days ago Zidane, who has a contract until 2022, denied press speculation he had already told his players he would be leaving at the end of the season.
"How am I going to tell my players that I am going now? It's a lie," he said after a 1-0 win at Athletic Bilbao.
"I'm focused on this season. There is a game left and we are going to give everything. I only care what happens in this finale," he said at the time.
But, perhaps tellingly, he added: "The rest, we will see at the end of the season."
The announcement marks the end of Zidane's second spell in charge of the Spanish giants.
The 1998 World Cup winner first took the helm in January 2016 and guided Real to the 2017 La Liga title and an unprecedented hat-trick of Champions League titles before abruptly quitting on May 31, 2018.
He returned in 2019, winning a second La Liga crown in 2020 and the Spanish Super Cup.
Zidane could take another break from football but he has been linked with taking charge of the French national team and Juventus, where he spent five years as a player.
However Didier Deschamps is likely to remain France coach until the 2022 World Cup in Qatar, barring a disastrous performance at the European Championship that kicks off next month.