Capital Gains Tax Calculator

Statutory IRS Section 121 Tax Model

Calculate your net taxable gain and total tax liability when selling residential real estate. Models adjusted cost basis, qualified capital improvements, IRS Section 121 primary residence exclusions ($250k single / $500k married), federal capital gains tax brackets, 3.8% NIIT, and state tax rules across all 50 states.

$
Agreed contract gross sales price at closing.
$
Original contract price plus qualifying buyer closing fees.
$
Permanent additions (roof, HVAC, remodel). Exclude routine repairs.
$
Broker commissions, title fees, transfer taxes, and legal costs.
Determines your statutory Section 121 exclusion ceiling.
Eligibility under IRS Section 121 ownership and use rules.
State capital gains tax rate on real property.
$
Annual W-2, 1099, and business income (for bracket stacking & NIIT).
$
Subject to 25% Section 1250 recapture (rental use or home office).
Total Estimated Tax on Sale
$0

Fully Excluded under IRS Section 121 ($0 Federal + $0 State Tax)

Adjusted Cost Basis
$385,000
Gross Realized Gain
$223,000
Section 121 Exclusion
-$223,000
Net Taxable Gain
$0
Federal Capital Gains Tax
$0
3.8% NIIT Surtax
$0
State Capital Gains Tax
$0
Net Walkaway Cash
$608,000
Home Sale Proceeds & Tax Allocation Waterfall
Adjusted Cost Basis
Selling Expenses & Commissions
Tax-Free Excluded Gain
Taxes Owed (Fed + State + NIIT)

How the Real Estate Capital Gains Tax Calculator Works

Calculating the true tax liability on a residential property sale requires navigating federal tax code provisions, statutory basis adjustments, primary residence exclusions, and state income tax rules. The gross sales price of your home is not your taxable gain; the IRS only assesses tax on net capital gains that exceed your adjusted cost basis and applicable statutory exemptions.

The Real Estate Capital Gains Calculation Algorithm Federal tax law under IRC Sections 1001, 1011, and 121 governs capital gains through a sequential multi-stage algorithm: 1. Amount Realized = Gross Contract Sale Price - Allowable Selling Expenses 2. Adjusted Cost Basis = Purchase Price + Acquisition Closing Costs + Qualified Improvements - Depreciation 3. Gross Realized Gain = Amount Realized - Adjusted Cost Basis 4. Net Taxable Capital Gain = Gross Realized Gain - Section 121 Primary Residence Exclusion 5. Total Tax Owed = Federal Capital Gains Tax + 3.8% NIIT Surtax + State Capital Gains Tax + Section 1250 Recapture

1. IRS Section 121: The Primary Residence Exclusion

The single most powerful wealth-preservation mechanism in the United States tax code is Internal Revenue Code Section 121. Under Section 121, homeowners can legally exclude up to $250,000 of capital gain if single, or up to $500,000 if married filing jointly, from all federal and state taxation upon the sale of their principal residence.

To qualify for the full exclusion, you must satisfy three statutory requirements:

  • The Ownership Test: You must have owned the property for at least 24 months (730 days) during the 5-year lookback period ending on the date of sale. For married couples claiming $500,000, only one spouse is required to satisfy the ownership test.
  • The Use Test: You must have lived in the property as your primary residence for at least 24 months during that same 5-year window. Both spouses must independently satisfy the use test to claim the full $500,000 joint exclusion.
  • The Two-Year Frequency Rule: You cannot have claimed the Section 121 exclusion on the sale of another home within the two years preceding the closing date.

2. Partial Exclusion Safe Harbors for Early Moves

If you lived in your home for less than 24 months, you do not automatically forfeit tax relief. Under IRC Section 121(c) and Treasury Regulation 1.121-3, taxpayers qualify for a prorated partial exclusion if the primary motivation for the sale falls into one of three statutory safe harbors:

  • Employment Relocation: Your new job location is at least 50 miles farther from your home than your old job was. If you were previously unemployed, the new job site must be at least 50 miles from the home being sold.
  • Health and Medical Treatment: The move is recommended by a licensed physician to obtain, provide, or facilitate the diagnosis, cure, or treatment of an illness, disease, or medical condition for you, your spouse, or a family member.
  • Unforeseen Circumstances: Involuntary events including natural disasters, casualty losses, legal divorce, legal separation, unemployment resulting in eligibility for unemployment compensation, or multiple births resulting from the same pregnancy (e.g. twins or triplets).

The partial exclusion formula prorates the maximum exclusion cap, not your gain: a married couple relocating for work after 12 months qualifies for 12/24ths of $500,000, or a $250,000 tax-free exclusion.

3. What Counts as a Qualified Capital Improvement?

Under IRS Publication 523 and Treasury Regulation 1.263(a)-3, a qualified capital improvement must materially add value to your property, significantly prolong its useful life, or adapt it to new uses. Routine repairs and maintenance cannot be capitalized.

Category Qualified Capital Improvements (ADDS to Basis) Routine Maintenance & Repairs (DOES NOT Add)
Structure & Additions Room additions, finished attic/basement, sunrooms, new garage, structural decks. Patching drywall, minor carpentry, fixing loose handrails.
Roofing & Exterior Complete new roof replacement, new siding, storm windows, replacement exterior doors. Replacing missing shingles, gutter cleaning, patching flashing, caulking.
Heating & Plumbing New central HVAC furnace/AC, heat pump, whole-house repiping, water heater installation. Annual HVAC furnace tune-up, replacing filters, fixing faucet leaks, clearing drains.
Kitchen & Bath New custom cabinetry, quartz/granite countertops, built-in appliances, complete tile showers. Refacing cabinet doors, reglazing tubs, repairing grout, fixing toilet flappers.
Finishes & Grounds New hardwood flooring, paved asphalt driveway, permanent fencing, in-ground pool. Interior or exterior painting, lawn mowing, mulching, driveway sealcoating.

4. Federal Long-Term Capital Gains Brackets & the 3.8% NIIT Surtax

For taxable gains exceeding the Section 121 exclusion (or investment properties held over one year), federal long-term capital gains tax rates of 0%, 15%, or 20% apply based on taxable income tiers:

  • 0% Rate: Applies to taxable income up to $48,350 for Single filers or $96,700 for Married Filing Jointly.
  • 15% Rate: Applies to taxable income between $48,351 and $533,400 for Single filers ($96,701 to $600,050 for Married Filing Jointly).
  • 20% Rate: Applies to taxable income exceeding $533,400 for Single filers or $600,050 for Married Filing Jointly.
  • 3.8% Net Investment Income Tax (NIIT): Imposed under IRC Section 1411 on the lesser of your net investment income or the amount by which your Modified AGI exceeds $200,000 (Single) or $250,000 (Married Filing Jointly). High-earning homeowners in the top bracket face an effective federal capital gains rate of 23.8%.

Capital Gains Tax Liability Sensitivity Matrices

The matrices below examine how varying home sale prices, residency durations, and filing statuses impact federal and state tax liabilities (assuming a $300,000 original purchase price, $40,000 in capital improvements, and $35,000 in selling costs):

Scenario 1: Home Sale Price Tiers vs. Filing Status (Primary Residence 2+ Years)

Gross Sale Price Adjusted Basis Realized Gain Single Filer Tax ($250k Cap) Joint Filers Tax ($500k Cap) Joint Filer Tax Savings
$500,000 $340,000 $125,000 $0 (Fully Excluded) $0 (Fully Excluded) $0
$650,000 $340,000 $271,000 $3,947 (on $21k excess) $0 (Fully Excluded) $3,947 Saved
$850,000 $340,000 $459,000 $39,292 (on $209k excess) $0 (Fully Excluded) $39,292 Saved
$1,100,000 $340,000 $694,000 $90,832 (on $444k excess) $36,472 (on $194k excess) $54,360 Saved
$1,500,000 $340,000 $1,070,000 $180,432 (on $820k excess) $124,192 (on $570k excess) $56,240 Saved

Scenario 2: Residency Duration & Partial Exclusion Impact ($750k Sale / $300k Basis)

Occupancy Duration Reason for Sale Allowable Exclusion Cap Taxable Net Gain Estimated Tax Liability
24+ Months (2 Years) Standard Sale $500,000 (100%) $0 $0
18 Months Job Relocation (50+ mi) $375,000 (75%) $30,000 $5,640
12 Months Medical Care / Health $250,000 (50%) $155,000 $29,140
6 Months Unforeseen Circumstances $125,000 (25%) $280,000 $53,880
Any Duration Investment Property / Rental $0 (0%) $405,000 $78,970

50-State Capital Gains Tax Benchmark Directory

Comprehensive 51-jurisdiction comparison modeling current median home sales and state tax rates.

Download 50-State CSV Dataset
State / Jurisdiction Median Sale Price Adjusted Cost Basis Gross Realized Gain Section 121 Excl. Taxable Gain State Rate Estimated Tax Owed
Alabama (AL) $225,000 $157,000 $54,500 -$54,500 $0 5.00% $0
Alaska (AK) $355,000 $273,000 $60,700 -$60,700 $0 0.00% $0
Arizona (AZ) $435,000 $250,000 $158,900 -$158,900 $0 2.50% $0
Arkansas (AR) $205,000 $145,000 $47,700 -$47,700 $0 4.40% $0
California (CA) $785,000 $530,000 $207,900 -$207,900 $0 13.30% $0
Colorado (CO) $575,000 $383,000 $157,500 -$157,500 $0 4.40% $0
Connecticut (CT) $395,000 $293,000 $78,300 -$78,300 $0 6.99% $0
Delaware (DE) $355,000 $257,000 $76,700 -$76,700 $0 6.60% $0
District of Columbia (DC) $625,000 $547,000 $40,500 -$40,500 $0 10.75% $0
Florida (FL) $405,000 $248,000 $132,700 -$132,700 $0 0.00% $0
Georgia (GA) $360,000 $219,000 $119,400 -$119,400 $0 5.49% $0
Hawaii (HI) $845,000 $630,000 $164,300 -$164,300 $0 7.25% $0
Idaho (ID) $450,000 $251,000 $172,000 -$172,000 $0 5.70% $0
Illinois (IL) $280,000 $213,000 $50,200 -$50,200 $0 4.95% $0
Indiana (IN) $245,000 $169,000 $61,300 -$61,300 $0 3.05% $0
Iowa (IA) $225,000 $172,000 $39,500 -$39,500 $0 3.80% $0
Kansas (KS) $235,000 $174,000 $46,900 -$46,900 $0 5.58% $0
Kentucky (KY) $220,000 $162,000 $44,800 -$44,800 $0 4.00% $0
Louisiana (LA) $215,000 $177,000 $25,100 -$25,100 $0 4.25% $0
Maine (ME) $380,000 $247,000 $110,200 -$110,200 $0 7.15% $0
Maryland (MD) $425,000 $320,000 $79,500 -$79,500 $0 5.75% $0
Massachusetts (MA) $620,000 $430,000 $152,800 -$152,800 $0 9.00% $0
Michigan (MI) $255,000 $171,000 $68,700 -$68,700 $0 4.25% $0
Minnesota (MN) $340,000 $254,000 $65,600 -$65,600 $0 10.85% $0
Mississippi (MS) $185,000 $138,000 $35,900 -$35,900 $0 4.70% $0
Missouri (MO) $250,000 $175,000 $60,000 -$60,000 $0 4.80% $0
Montana (MT) $465,000 $283,000 $154,100 -$154,100 $0 5.90% $0
Nebraska (NE) $265,000 $191,000 $58,100 -$58,100 $0 5.84% $0
Nevada (NV) $445,000 $261,000 $157,300 -$157,300 $0 0.00% $0
New Hampshire (NH) $460,000 $303,000 $129,400 -$129,400 $0 0.00% $0
New Jersey (NJ) $525,000 $373,000 $120,500 -$120,500 $0 10.75% $0
New Mexico (NM) $320,000 $213,000 $87,800 -$87,800 $0 5.90% $0
New York (NY) $460,000 $332,000 $100,400 -$100,400 $0 10.90% $0
North Carolina (NC) $370,000 $230,000 $117,800 -$117,800 $0 4.50% $0
North Dakota (ND) $260,000 $219,000 $25,400 -$25,400 $0 1.50% $0
Ohio (OH) $245,000 $170,000 $60,300 -$60,300 $0 3.50% $0
Oklahoma (OK) $210,000 $157,000 $40,400 -$40,400 $0 4.75% $0
Oregon (OR) $495,000 $337,000 $128,300 -$128,300 $0 9.90% $0
Pennsylvania (PA) $290,000 $203,000 $69,600 -$69,600 $0 0.00% $0
Rhode Island (RI) $465,000 $293,000 $144,100 -$144,100 $0 5.99% $0
South Carolina (SC) $360,000 $219,000 $119,400 -$119,400 $0 3.58% $0
South Dakota (SD) $310,000 $223,000 $68,400 -$68,400 $0 0.00% $0
Tennessee (TN) $380,000 $225,000 $132,200 -$132,200 $0 0.00% $0
Texas (TX) $345,000 $227,000 $97,300 -$97,300 $0 0.00% $0
Utah (UT) $520,000 $314,000 $174,800 -$174,800 $0 4.55% $0
Vermont (VT) $385,000 $252,000 $109,900 -$109,900 $0 8.75% $0
Virginia (VA) $420,000 $313,000 $81,800 -$81,800 $0 5.75% $0
Washington (WA) $615,000 $377,000 $201,100 -$201,100 $0 0.00% $0
West Virginia (WV) $165,000 $121,000 $34,100 -$34,100 $0 5.12% $0
Wisconsin (WI) $300,000 $203,000 $79,000 -$79,000 $0 5.36% $0
Wyoming (WY) $340,000 $245,000 $74,600 -$74,600 $0 0.00% $0

Real-World Persona Worked Example: The Miller Family

To examine how adjusted cost basis, capital improvements, Section 121 exclusions, and multi-state tax rates interact in practice, review the step-by-step audit for David and Elena Miller:

The Millers’ 10-Year Homeownership Audit

David and Elena purchased a home in July 2014 for $320,000. Over 10 years, they added $60,000 in qualifying capital improvements (kitchen renovation, new architectural shingle roof, and high-efficiency central heat pump). In August 2024, they sold the home for $950,000, paying $55,000 in broker commissions, transfer taxes, and title settlement fees. Their combined taxable W-2 income is $180,000 (Married Filing Jointly).

Contract Sale Price
$950,000
Adjusted Cost Basis
$386,000
Realized Gain
$509,000
IRS Section 121 Cap
-$500,000

Step-by-Step Mathematical Calculation:

  1. Initial Acquisition Basis (IRC § 1012): Purchase price of $320,000 plus $6,000 in qualifying buyer-paid closing fees (title insurance, attorney fees, survey, recording) = $326,000.
  2. Capital Improvements (Treas. Reg. § 1.263(a)-3): Kitchen remodel ($35,000) + complete roof ($15,000) + HVAC heat pump ($10,000) = $60,000 added. Routine painting ($4,000) and minor plumbing repairs ($800) are excluded. Final Adjusted Basis = $326,000 + $60,000 = $386,000.
  3. Amount Realized (IRC § 1001(b)): Gross contract price of $950,000 minus allowable selling expenses of $55,000 = $895,000.
  4. Realized Capital Gain: $895,000 (Amount Realized) – $386,000 (Adjusted Basis) = $509,000.
  5. Section 121 Primary Residence Exclusion: Because both spouses owned and occupied the home for 10 years, they claim the maximum Married Filing Jointly cap of $500,000. Net Taxable Capital Gain = $509,000 – $500,000 = $9,000.
  6. Federal Tax Liability: Stacking the $9,000 capital gain on top of their $180,000 ordinary income places the gain squarely inside the 15% federal capital gains bracket. Federal tax = $9,000 * 15% = $1,350. Their total MAGI ($189,000) is below the $250,000 NIIT threshold, resulting in $0 in NIIT surtax.
  7. State Tax Impact: If sold in Florida or Texas, state tax is $0. If sold in Pennsylvania, the gain is $0 under PA’s 100% principal residence exemption. If sold in North Carolina (4.50%), state tax is $405. If sold in California (9.3%), state tax is $837.
  8. Net After-Tax Walkaway: The Millers walk away with $893,650 in net cash ($950,000 sale – $55,000 costs – $1,350 fed tax), converting 94.1% of their home value into liquid wealth!

Regulatory Disclosures & Capital Gains Tax Nuances

Real estate capital gains taxation is strictly governed by Internal Revenue Service code and state revenue department mandates. Homeowners should prepare for the following compliance rules:

Section 1031 Exchange Restrictions

IRC Section 1031 like-kind tax-deferred exchanges apply exclusively to investment properties and commercial real estate held for business use. Section 1031 can NEVER be used to defer gains on a personal primary residence or personal second home.

IRS Form 1099-S Certification

Title closing agents must file Form 1099-S with the IRS reporting gross sales proceeds. To be exempt from 1099-S reporting, sellers must sign an IRS certification attesting under penalty of perjury that the full gain is excludable under Section 121 rules.

FIRPTA Foreign Seller Withholding

Under the Foreign Investment in Real Property Tax Act (FIRPTA), if the seller is a foreign national or non-resident alien, closing agents must legally withhold 10% to 15% of the gross sale price at closing for direct remittance to the IRS.

Depreciation Recapture is Never Excluded

Under IRC Section 121(d)(6), any depreciation claimed on the residence after May 6, 1997 (such as home office deductions or temporary rental periods) is strictly non-excludable and is taxed at up to a 25% federal recapture rate upon sale.

Calculator Verification & Tax Authority Source Metadata:

✓ Last verified: September 2026

✓ Statutory references: Internal Revenue Code Section 121 (Exclusion of Gain from Sale of Principal Residence), IRC Section 1001 (Determination of Amount and Recognition of Gain/Loss), IRC Section 1012 (Basis of Property), IRC Section 1250 (Depreciation Recapture), IRC Section 1411 (Net Investment Income Tax), IRS Rev. Proc. 2024-40 & 2023-34 (Capital Gains Tax Brackets).

✓ State tax datasets: State Departments of Revenue individual income tax schedules, Tax Foundation State Individual Income Tax Rates, Washington RCW 82.87.050 & RCW 82.45 REET.

✓ Calculator methodology reviewed and approved by: USPropertyStats Editorial & Real Estate Research Team.