With the rising interest in urban agriculture (UA), community gardens have emerged as a common instrument in UA policies aimed at addressing issues related to food security, environmental sustainability, and equality in urban development. As an impure public good, they deliver both private benefits, such as fresh produce, and public benefits, including ecosystem services. However, there has been limited research estimating the value of various features of community gardens. Consequently, assessing the benefit–cost ratio of community garden development policies is a challenging task. Furthermore, many existing community gardens might have been established without a comprehensive understanding of public preferences. To address this gap, we adopt a discrete choice experiment to quantify residents' willingness to contribute money and time to community gardens in Los Angeles County, California. Our findings indicate that while residents highly value the gardens' private benefits, they are not inclined to contribute to their public benefits. Additionally, residents' preferences for community gardens differ based on their socioeconomic status and level of accumulated gardening experience.