Eight towns in Massachusetts have been named among the best beach towns to live in America.

The data experts at Wallethub ranked 161 coastal towns and cities among the best to live in the country — with Swampscott (#27), Newburyport (#51), South Yarmouth (#67), Salem (#69), Gloucester (#88), Revere (#90), Lynn (#115), and Hull (#122) making the list for the Bay State.

The report — aptly named 2018’s Best Beach Towns to Live in — features other popular New England beach towns like Westport, CT (#9), and Portland (#12) and Brunswick (#21), Maine.

Wallethub’s data set ranged from housing costs to share of for-sale waterfront homes to quality of beach water. The town of Swampscott’s high ranking is due to its low cost of housing — ranking 4th lowest among the 161 towns.

To see where other towns across the country ranked, scroll the map below:

 

Source: WalletHub