A recent analysis ranked all 50 U.S. states to determine which one was the best to live in based on economy, education, safety, quality of life and affordability.

Continue Reading Below

The report by WalletHub named Massachusetts as the best state to live in. The state ranked second for economy and education and health. Massachusetts also took the number three spot on quality of life and fourth on safety but was toward the bottom of the list (43rd) for affordability.

Minnesota, New Hampshire, New Jersey and Colorado made the top five, respectively. Wisconsin, Virginia, Iowa, Utah and Idaho rounded out the top ten.

Mississippi came in last.

Louisiana, New Mexico, Arkansas and Alabama were also toward the bottom. The states that had the lowest housing costs were Iowa, Nebraska, North Dakota, South Dakota and Kansas, respectively. The highest housing costs included California, Hawaii, New York, Oregon and Florida.

The states with the lowest crime rates included Maine, Vermont, New Hampshire, New Jersey and Idaho. The states with the highest crime rates were Arkansas, Tennessee, Louisiana, Alaska and New Mexico.

WalletHub determined its findings by studying a state’s five key dimensions: affordability, economy, education & health, quality of life and safety. The company “evaluated those dimensions using 51 relevant metrics” which included a state’s median home price, property taxes, unemployment rate, economic confidence index, income growth, and the state’s graduation, crime and obesity rates.

Each of the 51 metrics were graded on a 100-point scale. Those that received a perfect score of 100 represented the “most favorable living conditions,” the online financial service said in its report.

CLICK HERE TO GET THE FOX BUSINESS APP

WalletHub obtained the data for its report by using figures from the U.S. Census Bureau, the Bureau of Labor Statistics and the Centers for Disease Control and Prevention as well as its own research.