A credit score, which generally ranges from a low of 300 to a high of 850, is an important measure of financial health. It can signify your trustworthiness to financial institutions and help determine how easy it is for you to buy a home or a car, or to rent an apartment.
To determine which places have the best — and worst — scores, financial website WalletHub used data from major credit-reporting bureau TransUnion to compare the "scores of residents in 2,572 U.S. cities."
Based on the data, here are the top five cities with the highest median scores:
1. The Villages, Florida
Median credit score: 806
2. Sun City Center, Florida
Median credit score: 791
3. Sun City West, Arizona
Median credit score: 789
4. Saratoga, California
Median credit score: 784
5. Green Valley, Arizona
Median credit score: 783
And here are the top five cities with the lowest median scores:
1. Camden, New Jersey
Median credit score: 543
2. East St. Louis, Illinois
Median credit score: 552
3. Chester, Pennsylvania
Median credit score: 552
4. Harvey, Illinois
Median credit score: 552
5. Detroit, Michigan
Median credit score: 552
It's no surprise that the top five cities with the highest scores are largely in states that are attractive to older people, since they're more likely to have good credit than younger ones. Florida and Arizona, for example, ranked No. 1 and No. 2 on SmartAsset's top 10 states where retirees moved most in 2018.

No matter how old you are, you could benefit from a credit check up. Total U.S. credit card debt reached a high point in 2017, passing $1 trillion, according to a report from Experian, and the average American carries a balance of over $6,300.
And though, at 675, the average credit score is better than it has been since 2012, Experian says, there's still room for improvement.
To up your score, be sure you're making payments in full and on time, since details about your payment history, including late or missed payments, are considered public record and can stay on your credit report for years.
Try to eliminate or minimize small, lingering balances, John Ulzheimer, a credit expert formerly of FICO and Equifax, tells Bankrate, since "one of the items your score considers is how many of your cards have balances."
Choose one or two go-to cards for most of your purchases, he suggests. "That way, you're not polluting your credit report with a lot of balances."
Also, look to reduce your credit utilization rate, which is the ratio of how much you're spending on your card compared to the card's limit. The ideal rate is less than 30 percent of your available credit.
It's important to stay knowledgeable about your score by checking it periodically. Most financial institutions allow you to check your score for free.
Like this story? Like CNBC Make It on Facebook!
Don't miss: It is possible to have a 'perfect' credit score if you prioritize these 4 things
Video by Beatriz Bajeulos Castillo
