The friendly fixture is being staged to celebrate the centenary of the Scottish club’s Tynecastle Main Stand and will form part of the pre-season programme for the Blues as they prepare to defend the Premier League crown.
Tickets are priced at £25 for adults and £15 for concessions.
As a special prelude to the big game, both sides will take part in an open training session on the Tynecastle pitch the night before the friendly, which will be free admission for all supporters.
Manchester City CEO, Ferran Soriano, said:
“Manchester City are honoured to join with Hearts FC as they celebrate the centenary of their main stand at the Tynecastle Stadium. Pre-season games are very important for the team’s training, but also give a special opportunity to bring City closer to fans wherever they are in the world.
“Edinburgh shares with Manchester a tradition of great footballing rivalry and we look forward to seeing the fans passion first hand.”
A Hearts spokesperson added: “We are proud to announce that we will be playing English Premier League champions Manchester City at Tynecastle on July 18.
“The Main Stand, which is an iconic landmark in British football, celebrates its centenary this year and what better way to mark the milestone than with a glamour friendly against one of the world’s top club sides?
“City will be bringing a strong squad to Edinburgh, with the likes of French internationalists Samir Nasri and Gael Clichy and Serbian star Aleksandar Kolarov all scheduled to make the trip.
“While recognising the past, the match will also see Hearts welcome the future.
“The game will be the first one at Tynecastle under new ownership, it will be head coach Robbie Neilson’s first home game in charge, while the team will be wearing the stunning new home kit for the first time.
“It promises to be a tremendous occasion under the floodlights and hopefully as many fans as possible can make it along for a very special night.”