The mortgage interest tax deduction is one of the big perks of homeownership. There’s a limit to how much you may deduct, though, and deducting more than your fair share could put you at risk of an audit.

You may only deduct mortgage interest if the debt is secured by your main or second home, and you can only deduct the interest on certain types of loans. In the 2014 tax year, these include:

Acquisition debt. This is a loan taken out after Oct. 13, 1987, to purchase, build, or improve your main home or second home, or a grandfathered loan taken out on or before Oct. 13, 1987, for the same purposes.

You may only deduct the interest on acquisition debt totaling $1 million or less ($500,000 or less if you’re married and filing separately).

Home equity debt. This is any other loan that doesn’t have anything to do with buying, building, or improving the home. Acquisition debt in excess of the $1 million limit can also qualify in some circumstances.

You may only deduct the interest on home equity debt totaling $100,000 or less ($50,000 or less if you’re married and filing separately).

Home improvement loans. You can deduct the points paid in the year you pay them on a loan taken out to improve your main home if you meet six IRS qualifications.

Refinanced loans. The allowable acquisition and improvement debt is the remaining balance on the loan or loans at the time you refinanced.

Say, for example, you bought your home for $100,000. Years later, the loan balance is down to $75,000 and the fair market value is $400,000. You take out a loan for $300,000, using your home as collateral.

The IRS regards your new loan as follows: $75,000—the balance of your original loan—is acquisition debt; $100,000 is a home equity line, the allowable limit; and $125,000 of the loan amount has non-deductible interest.

If you fall into the refinance category or own a high-value home, consider reviewing your last three years’ tax returns to make sure your tax deductions for your interest are not too high.

Don’t forget about the alternative minimum tax (AMT)

Keep in mind that when you deduct the interest on a home equity line of credit (HELOC), you need to add the deduction back for the AMT computation. Because your home may have appreciated greatly in value since you bought it, this can make you vulnerable to IRS audits.

For example, you may have refinanced and consolidated debt when your home was at the height of its value. Your IRS-defined home equity balance may be more than $100,000, so you could be deducting more interest than you are permitted. Or, you may not have realized that this debt was subject to the AMT and may not have added this interest back in.

If you have questions, contact your tax professional—he or she can help you figure things out.

Eva Rosenberg, EA is the publisher of TaxMama.com ®, where your tax questions are answered. She is the author of several books and ebooks, including Small Business Taxes Made Easy. Eva teaches a tax pro course at IRSExams.com and tax courses you might enjoy at http://www.cpelink.com/teamtaxmama.