Many of us make financial mistakes along the way, but sometimes they’re biggies. As in, bankruptcy big.

Maybe you had an employment gap or a medical emergency that took a toll on your finances. Or maybe you were unable to balance student loans, a car payment and other mounting bills. At some point, consumers may conclude that their best option is to start over with a clean slate through bankruptcy. But how long will that decision follow you? We take a look at how bankruptcy will affect your credit—and how you can rebuild it.

What is bankruptcy?

Declaring bankruptcy involves a somewhat convoluted legal process. The first step, though, is determining which type of bankruptcy suits your situation from the two kinds of bankruptcy—Chapter 7 and Chapter 13.

A Chapter 7 bankruptcy is often called a “liquidation” bankruptcy because a trustee has the authority to sell your property to repay creditors. In exchange, Chapter 7 bankruptcy offers discharge of “unsecured” debt (that is, credit card debt, medical expenses or other debts that are otherwise not secured by an asset), which means that all the debts will be forgiven and you will not have to pay them back.

While you might have to sell some of your property in a Chapter 7 bankruptcy, there are “exemptions” for what you can keep; i.e. a car worth a certain amount, some personal belongings and “tools of the trade,” which includes items that you need to do your job, such as actual tools or computer equipment. The federal exemptions are outlined here, and there are also state exemptions. In many states you may elect to use either your state exemptions or the federal ones.

Finally, you can only choose Chapter 7 bankruptcy if your income is low enough to pass the “means test,” which determines if you have sufficient disposable income to repay your creditors without having your debts forgiven. The higher your disposable income, the less likely you can file for Chapter 7. There are two forms that identify if you are a candidate for Chapter 7: the statement of your monthly income and the means test calculation.

In a Chapter 13 bankruptcy, known as a “reorganization” bankruptcy, you work with the court to create a repayment plan, where you will pay off your creditors rather than selling your property, on a schedule that typically lasts three to five years. Once you have paid off the agreed-upon portion of your debt, your other unsecured debts may also be discharged or forgiven.

How will a bankruptcy appear on your credit report?

Filing for bankruptcy might bring immediate relief, particularly if you have been suffering from financial stress. But it is not gone and forgotten, unfortunately.

As a public record, it will be listed on your credit report, although the two types have differing longevity: A Chapter 7 bankruptcy will stay on your report for 10 years from when you file while a Chapter 13 bankruptcy will disappear after seven years.

With a Chapter 7 bankruptcy, discharged debts will be listed as “included in bankruptcy” or “discharged” and show a $0 balance. And, while the bankruptcy itself stays on the account for 10 years, the accounts that are included in the bankruptcy will fall off after seven years.

You’ll want to check your credit report, though, to make sure they don’t show as “delinquent,” “outstanding,” “past due” or “charged off”—probably all words that were causing maximum stress prior to the bankruptcy filing. If you find a creditor hasn’t properly updated the information with the credit reporting agencies, you’ll need to dispute the notation using the online procedure outlined at the various credit bureaus’ websites. As the Fair Credit Reporting Act guidelines explain, they must take steps to rectify the situation.

Chapter 13 bankruptcies disappear sooner than those of Chapter 7 because you are paying back some of the money that you owe. In this type of bankruptcy, the accounts that you are handling will show as “included in bankruptcy” until your repayment plan is complete; then they will be updated to show “discharged.” Note that the seven-year period applies to accounts that were current as of the bankruptcy filing. Anything that was already delinquent is removed seven years from the original delinquency date.

Once the bankruptcy is discharged, it should disappear automatically from your credit report. If it doesn’t, you’ll need to send a copy of the notice to the credit reporting agencies to make sure that the bankruptcy notation is eliminated.

How will a bankruptcy impact your credit?

Your credit report is a tool to show lenders that you have responsible financial habits, thus making you a satisfactory risk for them to lend money to on the assumption that they will be paid back. With a bankruptcy on your record, you are showing them the opposite. However, bankruptcies do happen, even to conscientious people when they are going through a financial crisis. And sometimes it’s the best strategy for getting out from under oppressive (and stressful!) debt.

According to FICO, a bankruptcy will cause a bigger drop in credit score for someone with a clean credit record than someone who already had some dings. And, the more accounts that are included in the bankruptcy filing, the bigger the effect on your score.

When lenders view your credit report, it’s possible that they will be more forgiving of a Chapter 13 bankruptcy than a Chapter 7, because at least you made the effort to repay some of your debts.

But as long as the bankruptcy is on your credit report, it will be a factor in whether lenders want to extend you credit, and they are likely going to charge you a much-higher interest rate. However, the effect will diminish over time, so it’s smart to start thinking about your next steps to rebuild your credit and get back on stable financial footing.

How can you rebuild your credit after a bankruptcy?

The good news is that you can make strides to restore your credit starting on Day 1—even while the bankruptcy is still on your credit report. In order to rebuild your credit, you’ll want to take many of the same steps that you took to build your credit in the first place.

These include:

  • Checking your credit report for errors: While this is important for everyone, searching out errors takes on new urgency when you are working to repair bruised credit. You’ll want to make sure that the accounts have been coded correctly, as noted above. Review them while your bankruptcy is still pending, and then make sure to look again when the time is up to make sure the bankruptcy has been removed.

  • Applying for a secured credit card: Secured credit cards require a deposit equal to your credit line; so, for example, you would put down a $500 deposit and get a card that has a limit of $500. Although it doesn’t feel like a “credit” card, this is a great way to start rebuilding your credit as they are easier to obtain since the bank has your cash as collateral. Another option is to apply for an entry-level card.

  • Becoming an authorized user on another account: In this scenario, a trusted family member or friend adds you to their credit card account. You will get your own card, just as though the account were your own, and it helps you build credit. However, the person who owns the account is ultimately responsible for any charges you make so you would need to convince them that the reasons for your bankruptcy are behind you.

  • Maintaining smart financial habits: From now on, it’s more important than ever to pay your bills on time, keep accounts open, stay at an optimum credit-utilization ratio (the amount of your credit-card balance in comparison to your credit-card limit, ideally less than 30 percent) and avoid opening too many accounts—all the best practices that help you build and maintain solid-gold credit for the long haul.

While it might take time, with good financial habits your credit score might rebound to even higher than it was prior to your bankruptcy. And that’s something to celebrate.