Four Connecticut communities are in good shape when it comes to managing credit card debt, according to a recently released study.

A new WalletHub study determined where Americans have accumulated the most and least sustainable credit-card debts. The study drew upon TransUnion credit data to calculate the cost and time required to pay off the median card balances of more than 2,500 U.S. cities.

Wethersfield, Westport, Newington and Glastonbury Center were all in the 9th percentile of the study for most sustainable debt.

According to the study, Wethersfield had a median credit card debt of just over $2,500, at a cost to payoff of $143 over an eight-month period. Westport had a median credit card debt of over $6,200, at a cost to payoff of $354 over an eight-month period.

Greenwich has the least sustainable credit card debt of all Connecticut communities in the study. The median credit card debt is $5,361, at a payoff of $551 over a 15-month period, putting Greenwich in the 95th percentile.

The country as a whole is racking up debt at an unprecedented rate; the total credit card debt nationwide is a record $1 trillion, according to the Federal Reserve.