To qualify for this exclusion, you generally must meet two main tests within the ending on the date of the sale:
: You must have lived in the home as your main residence for at least 24 months . To qualify for this exclusion, you generally must
: Can exclude up to $500,000 of capital gains. To qualify for this exclusion
: If you used part of your home for business or rented it out, special rules apply that might limit your exclusion. the IRS provides Publication 523
For deeper details, the IRS provides Publication 523, Selling Your Home, which includes worksheets to help calculate your specific gain or loss.
: Unlike other investments, you cannot deduct a loss from the sale of your personal residence on your taxes.