Despite the fact that no invariant acoustic property corresponds to a single stop consonant coupled with different vowels (e.g., [da], [de], and [du]), adults effortlessly identify the same consonant embedded in different syllables. In so doing, they solve the invariance problem. Can 3- and 6-month-olds solve it as well? To answer this question, we developed a novel methodology based on pupillometry. In Experiment 1, we demonstrated for the first time that infants are sensitive to the distinction between frequent and infrequent acoustic stimuli, showing greater pupil dilation in response to infrequent stimuli. Building on this effect, in Experiment 2, we showed that 6-month-olds, but not 3-month-olds, solve the invariance problem. Moreover, this ability develops before, and therefore independently of, the ability to produce well-formed syllables.