Massachusetts is the best state to raise a family, new research suggests.

WalletHub released its annual list of best and worst states to raise a family, taking into account things like childcare costs, median family salary, housing affordability and unemployment rate and The Bay State ranked No. 1, while New Mexico came in dead last.

WalletHub compared the 50 states across 42 key indicators of things like family-friendliness, health and safety and education using 42 relevant metrics. Each metric was graded on a 100-point scale, with a score of 100 representing the most favorable conditions for family life.

SEE ALSO: 20 incredible charities that give 99% of the money they get to the actual cause

Massachusetts was trumpeted for being a fun, family safe state with affordable housing and good schools. The median household income is $67,846, according to the US Census Bureau, and the median list price for a home is currently $419,900 while the median price of homes that sold is $356,113, according to Zillow.

Minnesota took second place as the best state to live in, with the highest median family salary, which was $65,599 in 2016, according to the United States Census Bureau. New Hampshire came in third place with the lowest infant mortality rate, and North Dakota followed in fourth, ranking No. 1 for having a low divorce rate, lowest percentage of families in poverty, and some of the most affordable housing (the median home cost in North Dakota is $188,800).

Vermont, Wisconsin, New York, Iowa, Nebraska, and California rounded out the list of top 10 best, while Nevada, Georgia, Arkansas, South Carolina, Oklahoma, Louisiana, West Virginia, Alabama, Mississippi and New Mexico were ranked the top 10 worst cities to raise a family. New Mexico, the state known for its crop of green and red chile peppers, has a median household income of $43,872, and the average home value in New Mexico is $175,100, according to Zillow.

SEE ALSO: Serena Williams’ spot-on message to new working moms is a grand slam

What’s more, U.S. fathers today are spending more time caring for the kids than they did half a century ago, according to a recent Pew Research Center survey. Though 63% of dads said they spend too little time with their kids and a much smaller share, 36%, say they spend the right amount of time with them. Moms, by comparison, still do more of the child care and are more likely than dads to say they are satisfied with the amount of time they spend with their kids.