The U.S. is a transient society where people often relocate during the coures of their careers, which often brings up a question: Which one of these places will be best for my family?

WalletHub has taken a deep dive into this common dilemma with a study that assesses how each state ranks in terms of providing a good place to raise a family.

The study took in a wide variety of factors—about 49 metrics, in fact, divided among five categories: family fun, health and safety, education and child care, affordability and socioeconomics.

The family fun category, for example, considered the share of families with young children, each state's family attractions and fitness and recreational centers, and the share of children under 17 years old who live in neighborhoods with parks or playgrounds. The socioeconomic category, meanwhile, looked at data such as separation and divorce rates, poverty and unemployment rates, and the percentage of two-parent families in each state.

The affordability category went beyond just prices, including metrics such as credit scores, mortgage debt, college savings rates and the availability of paid family leave.

The ranking could be used as a guide for families facing a relocation, but WalletHub noted that with so many factors to consider, families will inevitably have to make some compromises. "Wants and needs don’t always align in a particular state," the report stated. "For instance, a state might offer a low income-tax rate but have a subpar education system. However, families do not need to make these kinds of tradeoffs."

Still, some states faired poorly no matter how you looked at the metrics. New Mexico achieved the inglorious distinction of finishing in last place on the list. The state was among the worst five states in the nation when it came to median family salaries, poverty rate, violent crime rate and divorce rate. Finishing just above New Mexico in the bottom five were, in ascending order, Mississippi, Lousiana, West Virginia and Alabama.

The following states, in ascending order, topped WalletHub's ranking for best places to raise a family:

10. Nebraska

The state finished ninth in the socioeconomic category, while it was also among the top 12 in health and safety, and in education and child care. Nebraska also ranks second in the nation for affordable housing and has the fourth-highest percentage of families with young children.

 

9. Rhode Island

The state was ranked the best in the nation in terms of affordability, while it was in the lower half of the rankings in socioeconomics.

 

8. New Jersey

The Garden State was second in the nation in the categories of education and child care and affordability. It also has the nation's fourth-lowest infant mortality rate and divorce rate.

 

7. Wisconsin

The state ranks fifth in affordability and 11th in socioeconomic factors.

 

6. New York

The state is second in the nation in family fun and third in affordability.

 

5. New Hampshire

The state is second overall for health and safety and sixth in socioeconomics. It also has the nation's lowest poverty rate, the second-lowest infant mortality rate and third-lowest violent crime rate.

 

4. Vermont

The state ranked first in health and safety, fourth in socioeconomics and fifth in education and child care. It also has the nation's lowest infant mortality rate and second-lowest violent crime rate.

 

3. North Dakota

The state ranks first in education and child care, and first in socioeconomics. It ranks fourth in terms of median family salaries and home affordability, has the second-lowest divorce rate and the fourth-lowest poverty rate.

 

2. Massachusetts

The state ranks third in health and safety, and in education and child care. It has the nation's third-lowest infant mortality rate.

 

1. Minnesota

The state didn't rank first in any of the five major categories, but was in the top 10 in most of them, finishing third in socioeconomics. The state has the nation's highest median family salary, is tied for the second-lowest poverty rate, and it has the third-lowest divorce rate.

The full report can be viewed here.