This paper develops a theoretical framework to consider fertility decisions within an endogenous sorting model of neighborhood effects. The models in the literature typically assume that each family is endowed with children whose expected schooling outcomes are determined by parental preferences on neighborhood quality. However, empirical studies report that the fertility dimension is also endogenous. Specifically, fertility is documented to be negatively related to neighborhood quality. We extend the model originally developed by Nesheim (2001) to account for endogenous fertility in a framework featuring endogenous contextual effects. Altruistic parents jointly choose how many children to produce and which neighborhood to live. We investigate whether the model can support an equilibrium where fertility is negatively related to neighborhood quality as the data suggest. We find that sorting over parental human capital cannot explain the observed negative relationship between fertility and neighborhood quality except for a restricted set of likely unrealistic parameter values. Sorting in terms of the human capital levels of children, however, can produce such an equilibrium for more reasonable parameter values. (C) 2011 Elsevier B.V. All rights reserved.