Figuring out capital gains tax when selling a house catches many first-time sellers off guard, especially when they hear about a federal exclusion that could shield up to $250,000 of profit from tax. What surprises many Maryland homeowners is that the exclusion is not automatic. You have to meet a specific set of tests, and failing even one of them can leave you owing tax on a gain you assumed was protected. Understanding the rules before you accept an offer gives you time to plan rather than scramble.

The exclusion we are talking about is called the Section 121 exclusion. It is in the federal tax code and allows qualifying homeowners to exclude up to $250,000 of profit from their taxable income when they sell their primary residence. Married couples filing jointly can potentially exclude up to $500,000, though that calculation has its own nuances covered separately. This article focuses on the two eligibility tests, the look-back rule, and the situations in which the exclusion shrinks or disappears entirely.

What the Ownership and Use Tests Actually Require

The IRS does not just ask whether you own the home. It asks two separate questions: how long have you owned it, and how long have you actually lived in it as your main home? Both have to clear a two-year minimum, and the way those two years are counted is more flexible than most sellers realize.

The Ownership Test

You need to have owned the home for at least 24 months out of the five years before the sale date. Those 24 months do not have to run consecutively. Say a Maryland homeowner purchased a home in 2019, moved away for 18 months to care for a family member, then returned and eventually sold in 2024. As long as the total ownership months in the five-year window add up to 24 or more, the ownership test passes.

Ownership is straightforward in most cases: your name is on the deed. Where it gets complicated is with trusts, life estates, and certain divorce-related transfers. If your home is held in a revocable living trust with you as the grantor, the IRS generally treats you as the owner for Section 121 purposes. If you received the home through a divorce settlement under a qualified domestic relations order, the period your spouse owned it may count as yours for the ownership test, but confirm this with a tax professional because the specifics matter.

The Use Test

The primary residence test is the one sellers most often underestimate. You must have used the home as your main residence for at least 24 months within the same five-year lookback window. “Main residence” means where you actually lived, not a vacation property or a home you kept mostly vacant.

The use test does allow certain gaps. Short absences, such as vacations or temporary work assignments, generally do not break your period of use. But extended rentals of the entire home do count as non-use periods. If you rented the whole house out for two of the last five years before selling, you may pass the ownership test but fail the use test entirely. That scenario has its own detailed treatment in another article in this series.

One non-obvious rule: the ownership and use tests do not have to overlap perfectly. You could own a home for four years, live in it for the first two years, rent it out for the final two, and still potentially satisfy both tests because each one measures its own 24-month minimum within the five-year window.

How the Two-Year Look-Back Rule Affects Maryland Sellers Who Sold Recently

Passing the ownership and use tests is not enough on its own. There is a third condition called the two-year look-back rule, and it trips up homeowners who sold a previous residence not long ago.

The rule is simple: you cannot claim the Section 121 exclusion if you already used it on a different home sale within the two years before your current sale date. The IRS does not let you stack the exclusion back-to-back across two properties.

Here is where Maryland sellers need to pay attention. If you sold a prior home in Maryland or elsewhere and used the exclusion, and you are now selling another home less than two years later, you are either ineligible for the exclusion entirely or eligible only for a reduced amount under the partial exclusion rules. The partial exclusion applies when you have a qualifying reason for the early sale, such as a job relocation or a health event. Without a qualifying reason, the exclusion is simply unavailable.

This matters practically in a rising market. Homeowners who bought and sold homes in quick succession during the past few years may be holding a large gain on their current home and not realize the look-back rule blocks the exclusion because they already used it on the previous sale. Pulling your prior closing documents and noting the sale date is a fast self-check before you do anything else.

Situations Where the Full Exclusion Gets Reduced or Denied

Even homeowners who meet the ownership test, the use test, and the look-back rule can find themselves with a reduced or denied exclusion. These are the situations that most sellers never think to ask about.

Periods of Non-Qualified Use

A rule that took effect in 2009 introduced the concept of non-qualified use. Any period after 2008 when the home was not used as your primary residence counts as non-qualified use, and that proportion of your gain cannot be excluded. The non-qualified use fraction is calculated as the total days of non-qualified use divided by the total days you owned the home.

Say you owned a Maryland home for eight years, spent the first three years renting it out, and then lived in it for five years before selling. The three rental years are non-qualified use. Roughly 37.5% of your gain (3 divided by 8) would not be eligible for the exclusion, even if you otherwise fully meet both tests.

There is an important exception: non-qualified use periods that fall at the end of ownership, after the last time you used the home as your primary residence, do not count against you in the same way. That is why the order of use matters, not just the total time.

Depreciation Recapture

If you ever claimed depreciation on this home, perhaps because you rented it or used part of it as a home office, that depreciation is recaptured as ordinary income when you sell. The Section 121 exclusion does not shield depreciation recapture. This is a cost category that surprises many sellers who took home office deductions over the years.

The Home Was Never Your Primary Residence

This one seems obvious, but it matters if you are considering whether to sell house as-is a property you inherited, used only as a vacation home, or held as an investment without ever living there. In those cases, the Section 121 exclusion does not apply at all, and the full gain is subject to capital gains tax. An inherited property has its own stepped-up basis rules that change the gain calculation, covered separately in this series.

Reporting the Sale on Your Return

Even if the exclusion fully covers your gain, you may still need to report the sale on IRS Form 8949 and Schedule D, depending on whether you received a Form 1099-S from the settlement agent. If the entire gain is excluded and you did not receive a 1099-S, you may not be required to report it. But if there is any taxable portion, any depreciation recapture, or if you received a 1099-S, the sale must be reported.

The reduced maximum exclusion applies when you meet the look-back rule or fail to fully satisfy the tests but have a qualifying exception, such as a change in employment, a health-related move, or other unforeseen circumstances recognized by the IRS. The exclusion in that case is prorated based on the fraction of the two-year requirement you actually met.

Understanding where you stand on all of these conditions is what determines whether you owe capital gains tax on selling a house or walk away from the closing table with the full profit in hand. If your situation involves any of the edge cases above, a licensed tax professional or CPA who handles residential real estate can run the actual numbers before you close. Some sellers find it worthwhile to get that review even when they think they clearly qualify, because the difference between meeting and missing a test is often a matter of exact dates. For Maryland homeowners who want to sell my house fast as-is and move on without a long listing process, knowing your tax position ahead of time means no surprises when you file.

Frequently Asked Questions

What Counts As A Primary Residence For The Section 121 Exclusion?

The IRS uses a facts-and-circumstances standard to determine your main home. The key factors are where you spend the majority of your time, the address on your tax return and driver’s license, and where your personal belongings are kept. If you own more than one home, only the one that functions as your primary residence qualifies.

What Happens If I Owned The Home For Less Than Two Years Before Selling In Maryland?

If your ownership or use falls short of 24 months and you do not have a qualifying reason for selling early, the Section 121 exclusion is not available and your gain is fully taxable. If you have a qualifying reason recognized by the IRS, you may be eligible for a reduced maximum exclusion, calculated in proportion to the portion of the two-year requirement you met.

Do I Have To Report My Maryland Home Sale To The IRS If The Full Gain Is Excluded?

Reporting depends on whether you received a Form 1099-S from the settlement agent at closing. If the gain is fully excluded and no 1099-S was issued, the IRS generally does not require you to report the sale. If any part of the gain is taxable or a 1099-S was issued, you must report the transaction on IRS Form 8949 and Schedule D with your federal return.