When selecting a college and degree, most Americans have to factor in student loan debt as a financial obligation.

Cities like New York and San Francisco, may offer job opportunities with good pay for recent grads, but the high cost of living may make it difficult to keep up with student loans.

Student loans make up the largest household debt next to mortgages, with $1.34 trillion in total outstanding college-loan balances disclosed on credit reports this year, according to the Federal Reserve Bank of New York. That's an increase of $34 billion since 2016.

WalletHub researchers compared the 50 U.S. states and the District of Colombia to see which fared best for earning opportunities and student loans.

California is the 4th rated state with least student loan debt and ranks 14 for grant and student work opportunities. However, the state ranks poorly for homeownership for people between the ages of 25 and 34. In fact, it ranks as the third worst state for people in that age group to buy homes.

Source: WalletHub

South Dakota had the most student debt in the country followed by New Hampshire and Ohio. Utah had the least student debt in the U.S. with Hawaii close behind.

WalletHub looked at factors such as the average student debt to unemployment rate among the population aged 25 to 34 to the share of students with past-due loan balances.