Vajnovszki recently developed a loopless algorithm [Inform. Process. Lett. 68 (1998) 113] to enumerate Gray codes for binary trees, and then Korsh and Lafollette gave a loopless algorithm [Inform. Process. Lett. 70 (1999) 7] to generate Gray codes for k-ary trees. In this paper, another loopless algorithm is presented to list Gray codes for k-ary trees more efficiently in both space and time than the two former algorithms, and the algorithm is also conceptually simpler than the predecessors. Based on the algorithm, Gray codes for k-ary trees with n internal nodes (n 2 and k > 3) can be generated in at least 22(n-1) different ways easily.