The youngest victim of the murderous rampage in a remote village in southwest China was three, the oldest 72. They were members of six families.
Suspect Yang Qingpei, aged in his 20s, went to his home village on Wednesday.
He was arrested in Kunming, capital of Yunnan Province, on Thursday.
The Xinhua state news agency report did not say how the villagers were killed.
Mass killings are rare in China and access to firearms is tightly controlled.
A Chinese man has confessed to killing his parents in an argument over money and then killing 17 neighbours in an attempt to cover up his crime, state media reported.