You can lower the tax on a capital gain by adjusting the two numbers that produce it: your cost basis and your amount realized. What you can deduct from capital gains tax comes down to four levers — an accurate basis that reflects your full investment and improvements, selling expenses that reduce your net proceeds, capital losses that offset gains dollar for dollar, and statutory exclusions or deferrals that can shield some or all of a specific gain. Each lever has its own rules, and none of them help if you can’t document them.
Start With an Accurate Cost Basis
Basis is the biggest number working in your favor. The higher your basis, the smaller the gain. Under federal law, basis begins with what you paid for the property.1Office of the Law Revision Counsel. 26 USC 1012 – Basis of Property – Cost But “what you paid” is broader than the sticker price. For stocks and bonds, your basis includes the purchase price plus any commissions and transfer fees you paid to acquire the shares.2Internal Revenue Service. Publication 551, Basis of Assets For real estate, it includes sales tax, recording fees, and legal fees tied to the purchase.
Capital Improvements on Real Estate
Money you put into a property beyond the original purchase increases your basis, as long as the work adds permanent value or extends the property’s useful life. A new roof, an added bathroom, whole-house window replacement, or a new HVAC system all qualify. These costs add to basis dollar for dollar and shrink the eventual taxable gain.3Internal Revenue Service. Publication 523, Selling Your Home
Routine maintenance doesn’t count. Painting a room, patching a leak, or replacing broken hardware keeps the property functional but doesn’t add to its value in the IRS’s eyes.3Internal Revenue Service. Publication 523, Selling Your Home One exception: a repair folded into a larger remodeling project can be treated as part of that project’s cost. Replacing a single broken window is a repair; replacing it as part of a whole-house window job is an improvement.
Inherited Property
Inherit an asset and you don’t inherit the original owner’s basis. The basis resets to the property’s fair market value on the date the owner died.4Internal Revenue Service. Gifts and Inheritances That step-up wipes out all the appreciation that built up during the deceased’s lifetime. A house your parent bought for $80,000 and left you when it was worth $450,000 has a $450,000 basis in your hands. Sell it soon after for that amount and there’s no gain to tax.
An executor can sometimes elect an alternate valuation date six months after death, but only if doing so decreases both the gross estate value and the total estate tax liability.5Office of the Law Revision Counsel. 26 USC 2032 – Alternate Valuation The election is irrevocable. For most heirs, the date-of-death value is the number that matters.
Gifted Property
Gifts follow a different rule. When someone gives you property, you generally take over the donor’s original basis.6Office of the Law Revision Counsel. 26 USC 1015 – Basis of Property Acquired by Gifts and Transfers in Trust If your uncle bought stock for $5,000 and gifted it to you when it was worth $12,000, your basis is $5,000. Sell for $15,000 and you have a $10,000 gain.
It gets tricky when the fair market value at the time of the gift is lower than the donor’s basis. A dual-basis rule then applies: you use the donor’s basis when calculating a gain, and the lower fair market value when calculating a loss.6Office of the Law Revision Counsel. 26 USC 1015 – Basis of Property Acquired by Gifts and Transfers in Trust Sell for an amount between those two figures and you have no gain or loss at all. Keep records of both numbers, or you’ll lose the benefit later.
Subtract Your Selling Expenses
The costs of completing the sale come off your proceeds. For real estate, the biggest one is usually the agent commission. Legal fees for closing documents, title insurance premiums, transfer taxes, recording fees, and even advertising and staging costs used to market the property all reduce the gain.3Internal Revenue Service. Publication 523, Selling Your Home Subtract them from the gross sale price and you get your “amount realized,” which is the number you compare to basis.
For securities, it’s simpler. Brokerage commissions and transaction fees on the sell side reduce your proceeds, just as commissions on the buy side increase your basis.2Internal Revenue Service. Publication 551, Basis of Assets With many brokers now offering commission-free trades, that adjustment may be zero, but any fee you did pay still counts.
Hold on to the paperwork. Closing disclosures, settlement statements, and brokerage confirmations are your proof if the IRS asks how you arrived at your numbers.
Offset Gains With Capital Losses
Capital losses cancel out capital gains directly, and the order of netting matters. Short-term losses offset short-term gains first, and long-term losses offset long-term gains first. Leftover losses in one category then cross over to offset gains in the other.7Internal Revenue Service. Topic No. 409, Capital Gains and Losses The netting itself happens on Schedule D, with each individual sale reported on Form 8949.8Internal Revenue Service. Instructions for Form 8949
If your total losses for the year exceed your total gains, up to $3,000 of the excess can be deducted against ordinary income like wages and interest. The limit drops to $1,500 if you’re married filing separately.7Internal Revenue Service. Topic No. 409, Capital Gains and Losses
Carrying Losses Forward
Losses that exceed both your gains and the $3,000 ordinary-income deduction don’t disappear. They carry forward to the next tax year, keeping their character as short-term or long-term.9Internal Revenue Service. Instructions for Schedule D (Form 1040) A $50,000 loss in one bad year can offset $3,000 of ordinary income annually and neutralize gains in future years until it’s fully absorbed. There’s no expiration.
The catch: carryovers die with the taxpayer. A capital loss carryover can be used on the decedent’s final return, subject to the normal limits, but neither the estate nor a surviving spouse can carry the remaining balance forward.10Internal Revenue Service. Decedent Tax Guide Track carryovers year to year. If you skip one, you may need an amended return to recover the benefit.
The Wash Sale Trap
You can’t sell a stock at a loss, buy it right back, and claim the deduction. The wash sale rule disallows the loss if you purchase substantially identical stock or securities within 30 days before or after the sale.11Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities That 61-day window catches most attempts to harvest a loss while keeping the same position.
The disallowed loss isn’t lost forever. It’s added to the basis of the replacement shares, so you get the benefit when you eventually sell those without triggering another wash sale.11Office of the Law Revision Counsel. 26 USC 1091 – Loss From Wash Sales of Stock or Securities Sold shares at a $2,000 loss and rebought for $8,000? Your new basis is $10,000. The rule applies to stocks, bonds, options, and contracts to acquire securities. It does not currently apply to cryptocurrency by statute.
Exclude Gain on a Primary Home
The largest tax break most homeowners ever use is Section 121, which excludes up to $250,000 of gain on the sale of a primary residence. Married couples filing jointly can exclude up to $500,000.12Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence For the joint amount, at least one spouse must meet the ownership requirement and both must meet the use requirement.
You have to have owned the home and lived in it as your primary residence for at least two of the five years before the sale. The 24 months don’t need to be consecutive; they just need to add up within the five-year window.12Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence You also can’t have used the exclusion on another sale in the prior two years. Gain above the exclusion is taxed at the applicable capital gains rate.
Partial Exclusion for an Early Sale
If you sell before meeting the full test, you may still get a prorated exclusion if the sale was primarily due to a change in workplace location, a health issue, or an unforeseeable event.3Internal Revenue Service. Publication 523, Selling Your Home Qualifying unforeseeable events include natural disasters that damage or destroy the home, divorce, death of a resident, job loss leading to inability to afford basic living expenses, and multiple births from the same pregnancy.
The exclusion is proportional to how much of the two years you completed. Live in the home for 15 of the required 24 months and your maximum exclusion is 15/24 of the applicable cap — roughly $156,250 for a single filer. Even a partial exclusion can shelter a large chunk of gain, so run the calculation before assuming you owe the full tax.
Defer Gain on Investment Real Estate With a 1031 Exchange
Instead of paying tax now on the sale of investment or business real estate, a like-kind exchange under Section 1031 lets you roll the gain into a replacement property and defer the tax. Since the 2017 tax law changes, this applies only to real property, not equipment, vehicles, or other personal property.13Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment Both properties must be held for business or investment use. Your personal residence doesn’t qualify.
The timelines are strict. You have 45 days from the sale of the relinquished property to identify potential replacements in writing, and 180 days to close.13Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment Miss either deadline and the exchange fails, leaving a fully taxable gain. Most investors use a qualified intermediary to hold the sale proceeds, because touching the money yourself can disqualify the transaction.
A 1031 exchange defers the gain rather than eliminating it, reducing the basis of the replacement property. Exchange repeatedly over a lifetime and the built-in gain can ultimately be eliminated at death through the step-up in basis your heirs receive.
Report It So the Deductions Stick
Paperwork protects every deduction you’ve claimed. Individual transactions go on Form 8949, with the sale date, proceeds, cost basis, and any adjustments for each asset.8Internal Revenue Service. Instructions for Form 8949 Totals flow to Schedule D, where short-term and long-term amounts get netted.9Internal Revenue Service. Instructions for Schedule D (Form 1040)
Your broker will send you Form 1099-B showing the proceeds and, for covered securities, the cost basis and holding period. Compare those figures against your own records. Brokers sometimes get basis wrong on transferred shares or shares affected by corporate actions, and the IRS receives the same 1099-B you do. If the reported basis is too low, you’ll overpay unless you correct it on Form 8949. Keep purchase confirmations, reinvestment records, and improvement receipts for as long as you own the asset, plus at least three years after you file the return reporting the sale.