When it comes to buying a home, the quality of the area’s public schools can play a major role in the planning decision — even if you don’t have young children, proximity to quality districts can affect home values.

Niche, a data site that specializes in education rankings, weighed a number of factors, including academic performance, diversity, parent/student surveys, sports, clubs and more to determine which communities in California have the best public schools in 2023.

When it comes to the top 20 places in California, the greater San Diego area swept the top three spots, Niche found:

PlaceMetro areaState2023 ranking2022 ranking2021 ranking
Rancho Santa FeSan Diego AreaCalifornia111
Fairbanks RanchSan Diego AreaCalifornia222
Del MarSan Diego AreaCalifornia333
Los Altos HillsSan Francisco Bay AreaCalifornia465
Solana BeachSan Diego AreaCalifornia544
La Cañada FlintridgeLos Angeles AreaCalifornia657
Palos Verdes EstatesLos Angeles AreaCalifornia799
EncinitasSan Diego AreaCalifornia8712
MoragaSan Francisco Bay AreaCalifornia91523
Rolling Hills EstatesLos Angeles AreaCalifornia101011
South PasadenaLos Angeles AreaCalifornia111320
Rolling HillsLos Angeles AreaCalifornia121110
San MarinoLos Angeles AreaCalifornia1388
ArcadiaLos Angeles AreaCalifornia141415
LoyolaSan Francisco Bay AreaCalifornia151722
PleasantonSan Francisco Bay AreaCalifornia162016
ArtesiaLos Angeles AreaCalifornia174736
Redondo BeachLos Angeles AreaCalifornia192237
(Credit: Niche)

While not heavily represented in the top 20, several places in the San Francisco Bay Area just missed the list, including Ross (21), Mountain View (22), Sausalito (24), Marin City (25) and Woodacre (26).

Perhaps not surprisingly, most of the areas listed are far from affordable for many people, so if you’re moving to avoid paying for private education, you may want to factor that in.

The median listing price for homes in Rancho Santa Fe, for example, is $4.9 million, according to RedFin. For those hoping to spend a bit less, Artesia and Moraga both came in at median listing prices of only $622,500 and $1.5 million, respectively.

To see the full list of the best public schools in the U.S., see Niche’s recently released rankings.