The 35-year-old batsman has played 93 T20s for his country since making his debut against Zimbabwe in 2011, captaining the side 75 times and leading them to the World Cup final in 2021 and semi-finals in 2016 and 2022.
"It's something that I've loved being a part of for a long period of time and I'm so grateful for the memories and experiences," Williamson said.
"It's the right time for myself and the team. It gives the team clarity for the series moving forward and ahead of their next major focus which is the T20 World Cup.
"There's so much T20 talent there and the next period will be important to get cricket into these guys and get them ready for the World Cup."
Williamson scored 2575 runs in T20 internationals with 18 half centuries, including his 85 in a losing cause in the T20 World Cup final against Australia in 2021
New Zealand cricket said Williamson, who no longer has a central contract, was open-minded about his future in one-day internationals and would definitely play in the three-Test series against West Indies in December.
"Kane's performances as a player and his service as captain of the T20 side have been nothing short of immense," said NZ Cricket chief executive Scott Weenink.
"His runs in all conditions around the world reflect the world class batsman that he is and are equally matched by the influence of his leadership on and off the field.
"With Kane committed to play the West Indies Test series in December, I'd encourage all Kiwis to take the opportunity to get out and witness one of our greatest ever cricketers play."