Each year, over 500,000 Americans file for bankruptcy, and the reasons run the gamut from overspending on needless purchases to racking up unavoidable medical debt. If you're planning to declare bankruptcy, you should know that while it might seem like an easy solution to your debt problem, it's actually far from a picnic. That's because a bankruptcy will stay on your record for up to seven years in the case of a Chapter 13 filing and up to 10 years in the case of Chapter 7. The good news, however, is that you can establish good credit even with a bankruptcy filing on your record. Here's how.

Building credit after a bankruptcy filing

Many people who file for bankruptcy ultimately find it difficult to recover. That's because a single bankruptcy filing could cause a good credit score to drop by 200 points or more and a bad score to drop between 130 and 150 points. Furthermore, a bankruptcy will remain on your credit report for up to seven or 10 years depending on the specifics of your case. During this time, you might struggle to get approved for an apartment lease, car loan, or credit card, among other things.

Binder labeled bankrupt


That's why it's crucial to work on boosting your credit score immediately after you file for bankruptcy. (In other words, don't wait seven to 10 years to start working on your credit; rather, take steps to improve it right away.) From that point forward, be sure to pay every single bill you receive on time and in full to improve your payment history. Of the different factors that go into determining your credit score, payment history carries the most weight. If you establish a pattern of paying your bills responsibly, your score might start to recover more quickly.

Of course, you might struggle to get access to a line of credit after a bankruptcy filing, making it difficult to establish a solid payment history. If that's the case, then your best bet may be to apply for a secured credit card. A secured credit card works just like a regular one, except instead of getting a line of credit, you're required to put down a deposit that serves as your credit limit. From a consumer perspective, there's really not much difference between using a secured credit card versus a debit card. But from a credit perspective, the former can work to boost your score, which is why it's a route worth pursuing.

That said, while it's a good idea to open a secured credit card to improve your score, or even a standard credit card, don't attempt to borrow too much at once in the years following a bankruptcy filing. Not only are you more likely to get the least favorable rates out there, but too many hard inquiries on your credit record can actually cause your score to go down.

Establish a safety net

One additional -- and critical -- step to take following a bankruptcy filing is to establish an emergency fund, and ideally one with enough money to cover at least three months' worth of living expenses. Though having cash reserves won't actually impact your credit score, what it will do is enable you to keep up with your expenses, thus allowing you to avoid debt in the future.

Remember, the point of filing for bankruptcy is to start over with a clean financial slate. But if you're not responsible about how you save and spend money going forward, you're likely to repeat the same mistakes that landed you in debt in the first place.

While filing for bankruptcy might seem like an irrecoverable blow to your credit, it doesn't have to be that way. A few smart moves and habits could be just the thing to turn a poor credit score into a respectable one.

The Motley Fool has a disclosure policy.