PASADENA, Calif. — When top students from the sun-dappled suburbs that surround Pasadena, Calif., graduate from high school, they are expected to go to colleges that are prestigious, pricey and often far away. Last year, seniors from La Cañada High School, one of the highest rated in the state, fanned across the country to M.I.T., the University of Michigan and Yale.

But 18-year-old Annie Shahverdian, the daughter of a commercial real estate agent and a nursing administrator, started her higher ed journey closer to home, 15 minutes down the road at the local community college. To save money, she is planning to spend two years at Pasadena City College, a two-year public institution, before heading to what she hopes will be a top four-year university where she will earn her bachelor’s degree.

“My parents don’t want to just throw money around now,” Ms. Shahverdian said as she walked across Pasadena’s 53-acre campus, heading toward her English class. “I’m getting a great education at a fraction of the cost.”

Community colleges have long catered to low-income students who dream of becoming the first in their families to earn a college degree. And for many, that remains their central mission. But as middle- and upper-middle-class families like the Shahverdians face college prices in the hundreds of thousands of dollars, more of them are looking for ways to spend less for their children’s quality education.