The 36-year-old cited injury problems as a factor in his decision, with the Black Caps agreeing to his request to release him from his central contract.
"I accept that I am not getting any younger and that the training is getting harder, particularly with the injuries," de Grandhomme told New Zealand Cricket.
"I also have a growing family and am trying to understand what my future looks like post-cricket. All of this has been on my mind over the past few weeks.
"I've been fortunate enough to have had the opportunity to play for the Black Caps since debuting in 2012 and I'm proud of my international career - but I feel this is the right time to finish."
De Grandhomme averaged 38.7 runs over 29 Test matches and took 49 wickets, including six for 41 on his debut against Pakistan.
He helped his side ascend to number one in the world rankings and reach the final of the 2019 Cricket World Cup in England.