You may be wondering if there are tax deductions when selling a home. And the answer is: You bet!

But there's also a new tax code—aka the Tax Cuts and Jobs Act—causing quite a bit of confusion this filing season. Rest assured that if you sold your home last year (or are planning to in the future), the tax deductions may amount to sizable savings when you file with the IRS.

You'll want to know all the tax deductions (as well as tax exemptions or other write-offs) at your disposal. So here's a rundown.

1. Selling costs

Good news! These deductions are still allowed under the new tax law as long as they are directly tied to the sale of the home and the taxpayer lived in the home for at least two out of the five years preceding the sale. Another caveat: The home must be a principal residence and not an investment property.

This could also include home staging fees, according to Thomas J. Williams, a tax accountant who operates Your Small Biz Accountant in Kissimmee, FL.

Just remember that you can’t deduct these costs in the same way as, say, mortgage interest. Instead, you subtract them from the sales price of your home, which in turn positively affects your capital gains tax.

2. Home improvements and repairs

Score again. The new tax law left this deduction as well. If you renovated a few rooms to make your home more marketable (and so you can fetch a higher sales price), now you can deduct those upgrade costs as well. This includes painting the house or repairing the roof or water heater.

But there’s a catch, and it all boils down to timing.

“If you needed to make home improvements in order to sell your home, you can deduct those expenses as selling costs as long as they were made within 90 days of the closing,” says Zimmelman.

3. Property taxes

This deduction is still allowed, but your total deductions are capped at $10,000, Zimmelman says.

If you were dutifully paying your property taxes up to the point when you sold your home, you can deduct the amount you paid in property taxes this year up to $10,000.

4. Mortgage interest

As with property taxes, you can deduct the interest on your mortgage for the portion of the year you owned your home. However, the rules have changed slightly from last year.

Just remember that under the new tax code, new homeowners (and home sellers) can deduct the interest on up to only $750,000 of mortgage debt, though homeowners who got their mortgage before Dec. 15, 2017, can continue deducting up to the original amount up to $1 million, according to Zimmelman.

Note that the mortgage interest and property taxes are itemized deductions. This means that for it to work in your favor, all of your itemized deductions need to be greater than the new standard deduction, which the Tax Cuts and Jobs Act nearly doubled to $12,200 for individuals, $18,350 for heads of household, and $24,400 for married couples filing jointly (for comparison, it used to be $12,700 for married couples filing jointly).

5. But what's up with capital gains tax for sellers?

Lawmakers tried to change the capital gains rule, but it managed to survive—so it’s still one home sellers can use. It isn't technically a deduction (it's an exclusion), but you’re still going to like it.

As a reminder, capital gains are your profits from selling your home—whatever cash is left after paying off your expenses, plus any outstanding mortgage debt. And yes, these profits are taxed as income. But here's the good news: You can exclude up to $250,000 of the capital gains from the sale if you’re single, and $500,000 if married. The only big catch is you must have lived in your home at least two of the past five years.

However, look for the rules of this exemption to possibly change in a future tax bill.

Ralph DiBugnara, president of Home Qualified and vice president at Residential Home Funding, says lawmakers might push to change this so that homeowners would have to live in the property for five of the past eight years, instead of two out of five.