IntroductionSubjective well-being (SWB) is attributable to both individual and environmental attributes. However, extant studies have paid little attention to the contribution of environmental attributes at the urban level to SWB or their nonlinear associations with SWB.MethodsThis study applies a machine learning approach called gradient boosting decision trees (GBDTs) to the 2013 China Household Income Survey data to investigate the relative importance of urban and individual attributes to and their nonlinear associations with SWB.ResultsThe urban and individual attributes make similar relative contributions to SWB. Income and age are the most important predictors. Urban facilities make a larger contribution than urban development factors. Moreover, urban attributes exert nonlinear and threshold effects on SWB. Cultural facilities and green space have inverted U-shaped correlations with SWB. Educational facilities, medical facilities, and population size are monotonically associated with SWB and have specific thresholds.DiscussionImproving urban attributes is important to enhancing residents’ SWB.