The best small towns can offer friendly neighbors, safe streets, and excellent schools along with cultural and recreational activities—and, of course, quieter alternatives to nearby bustling cities.

To find the best small towns to live in across America, Stacker referenced Niche's Best Places to Live Study for 2020 which ranks American towns by overall quality of life. The variables used by Niche include cost of living, health and fitness, and weather. Any town with more than 40,000 people or was categorized as "urban" or "dense urban" was excluded.

The top cities on this list run the gamut from long-established villages in the suburbs of New York City to planned communities in Virginia and Texas. Communities on Long Island feature an old Quaker meeting house, a stop on the Underground Railroad, and the neighborhoods that inspired F. Scott Fitzgerald’s “The Great Gatsby.” In Texas, meanwhile, what was once a working ranch has become a planned community for thousands of residents.

Many such towns grew up along railroad lines as pioneers pushed westward. A group of nuns traveling through Elm Grove, Milwaukee, decided to stop when their horses did and established a convent there. Some were developed as the country’s first suburbs, especially for servicemen returning from war and in need of housing.

Many communities are near universities, with all of the intellectual offerings they bring, from lectures and concerts to museums and classes. Los Alamos, New Mexico, is known for the Los Alamos National Lab, while Princeton, New Jersey, is famed not only for the university of the same name but also the Institute for Advanced Study, where Albert Einstein worked. Other towns work to maintain their community traditions—apple festivals, communal gardens, ice cream socials, and harvest markets—reflecting their roots as farming towns.

Still others have unusual origins. Grosse Pointe Park, Michigan, and Whitefish Bay, Wisconsin, began as resorts. Some town names reflect America’s diversity, from Creve Coeur, Missouri, which means “heartbreak” in French, to Okemos, Michigan, honoring a Native American chief. And they point to the future American housing—especially examples of the “new urbanism,” where homes, offices, and shops are linked together in walkable neighborhoods and public spaces.

LOOK: Here are the best small towns to live in across America

More From 96.5 KVKI