Six Boston suburbs have been named among the 20 best small communities in America by a new analysis by personal finance site WalletHub, based on U.S. Census Bureau data.

Melrose ranked at No. 4, Lexington at No. 6, Milton at No. 7, Needham at No. 11, Newton at No. 16 and Arlington at No. 18.

They lost out to the first-place winner and Kansas City suburb Leawood, Kansas, Nashville suburb and second-place winner Brentwood, Tennessee and third-place winner Seattle exurb Sammamish, Washington.

WalletHub compared more than 1,200 U.S. cities with populations between 25,000 and 100,000 across 42 key indicators of livability. They range from housing costs to school-system quality to restaurants per capita.

All six of the Massachusetts communities suffered major penalties for their high housing costs but managed to climb back into the top spots thanks to the quality of their schools, low crime rates and the relatively good quality of life they offer.

Six Boston Suburbs Named Among ‘Best Small Cities in America’

by Banker & Tradesman time to read: 1 min
0