A sense of non-symbolic numerical magnitudes is widespread in the animal kingdom and has been documented in adult zebrafish. Here, we investigated the ontogeny of this ability using a group size preference (GSP) task in juvenile zebrafish. Fish showed GSP from 21 days post-fertilization and reliably chose the larger group when presented with discriminations of between 1 versus 3, 2 versus 5 and 2 versus 3 conspecifics but not 2 versus 4 conspecifics. When the ratio between the number of conspecifics in each group was maintained at 1 : 2, fish could discriminate between 1 versus 2 individuals and 3 versus 6, but again, not when given a choice between 2 versus 4 individuals. These findings are in agreement with studies in other species, suggesting the systems involved in quantity representation do not operate separately from other cognitive mechanisms. Rather they suggest quantity processing in fishes may be the result of an interplay between attentional, cognitive and memory-related mechanisms as in humans and other animals. Our results emphasize the potential of the use of zebrafish to explore the genetic and neural processes underlying the ontogeny and function of number cognition.