People innately love being near the water. Just the act of looking at a body of water--in real life or in a photograph--measurably lowers stress levels. Sure, the average cost of a waterfront home in the U.S. is about double that of a similar house located inland, but you get what you pay for: People who live near rivers, lakes, and oceans are also happier and healthier than those who live away from water. When you think of it that way, maybe that waterfront view is worth spending extra money on rent.

The median sale price of a home in Malibu, California, as of February 2021 was more than $4 million, to be sure, but that doesn't mean all beach property breaks the bank. Coastal properties in Mississippi, Texas, and Florida are among the most affordable homes near the water anywhere in the country.

LOOK: See America's 50 Best Beach Towns

Every beach town has its share of pluses and minuses, which got us thinking about what makes a beach town the best one to live in. To find out, Stacker consulted data from WalletHub, released June 17, 2020, that compares U.S. beach towns. Ratings are based on six categories: affordability, weather, safety, economy, education and health, and quality of life. The cities ranged in population from 10,000 to 150,000, but they had to have at least one local beach listed on TripAdvisor. Read the full methodology here. From those rankings, we selected the top 50. Readers who live in California and Florida will be unsurprised to learn that many of towns featured here are in one of those two states.

Keep reading to see if your favorite beach town made the cut.

More From TheFW