Cooperation between nonrelatives is common in humans. Reciprocal altruism is a plausible evolutionary mechanism for cooperation within unrelated pairs, as selection may favor individuals who selectively cooperate with those who have cooperated with them in the past. Reciprocity is often observed in humans, but there is only limited evidence of reciprocal altruism in other primate species, raising questions about the origins of human reciprocity. Here, we explore how reciprocity develops in a sample of American children ranging from 3 to 7.5 years of age, and also compare children's behavior to that of chimpanzees in prior studies to gain insight into the phylogeny of human reciprocity. Children show a marked tendency to respond contingently to both prosocial and selfish acts, patterns that have not been seen among chimpanzees in prior studies. Our results show that reciprocity increases markedly with age in this population of children, and by about 5.5 years of age children consistently match the previous behavior of their partners.