RetirePay

Three Things the IRS Lets You Subtract Before Taxing Your Gain

Most sellers find out about all three after the sale — when it is too late to use them.

Find financial advisors who serve your area, free!

In the press

The Wall Street JournalForbesThe New York Times

August 2026  |  By Michael Reeves · RetirePay Research

Selling something you have held for a long time can come with a large tax bill.

Most people only find out how large after the sale is done.

By then, the number is set. Nothing can change it.

This matters most when what you are selling is worth a lot more than you paid for it. If the difference is small, the tax is small too — and there is not much to plan.

But when the difference is large, the tax code gives you real ways to bring that number down. Most of them have to be used before you sell.

Here are three of them.

Every Sale Has a Different Answer

A fiduciary advisor can look at your situation before you sell — while there is still time to change the outcome.

1. What You Actually Paid Is Probably Higher Than You Think

The tax is not on what you sell for. It is on the difference between what you sell for and what you paid.

That second number is called your “cost basis.” And most people get it wrong — in a way that costs them money.

Here is the most common mistake.

If you owned a fund or a stock that paid dividends, and those dividends were automatically used to buy more shares, you already paid tax on that money in the year you received it.

Those dividends count as money you paid in.

If you leave them out, you are taxed on the same money twice.

A few others that get missed:

  • Commissions and fees you paid when you bought count as part of what you paid.
  • Stock splits change your per-share number. The total stays the same, but the math confuses people.
  • Inherited investments usually reset to their value on the date of death — not what the original owner paid. This one is often worth the most, and it is often missed.
  • Gifted investments are the opposite. You usually keep whatever the person who gave it to you paid.

Why this happens so often: brokers were only required to track and report cost basis starting in 2011. If you have held something longer than that, or moved it between firms, the number on your statement may be missing or simply wrong.

You are the one responsible for proving it. Not your broker.

2. The Costs of Owning the Investment

Some of what you spent while you held the investment can be used to lower your bill.

Margin interest. If you borrowed against your account to invest, the interest may be deductible against your investment income. If you do not have enough investment income this year to use it, it usually carries forward to future years.

One that surprises people: the fee you pay your advisor is no longer deductible. That changed in 2018 and has not come back. Many people are still deducting it, or still assuming they can.

The order you sell in matters too. If you own the same investment bought at different times and different prices, you can choose which shares to sell — the expensive ones or the cheap ones. Pick the expensive ones and your gain is smaller.

But you have to tell your broker at the time of the sale. Not in April. If you say nothing, most brokers sell your oldest shares first, which are usually the ones with the biggest gain.

That single instruction, given at the right moment, can change the size of the bill.

3. The Costs of the Sale Itself — Especially on Property

When you sell property, a large amount of what you spend comes off the top.

The commission you pay the agent is subtracted from your sale price. On a high-value home, that alone is a significant number.

Closing costs count on both ends — what you paid when you bought, and what you pay when you sell. Title fees, legal fees, transfer taxes.

Improvements count. Repairs do not. This is the line most people get wrong.

  • A new roof, a new kitchen, an added room, a new HVAC system — these are improvements. They get added to what you paid.
  • Painting, fixing a leak, replacing a broken window — these are repairs. They do not.

Over twenty years of owning a home, the improvements can add up to a very large number.

And if the property was your main home, a married couple filing jointly can often exclude up to $500,000 of the gain entirely. A single filer, up to $250,000. There are rules about how long you lived there.

The catch on all of it: you need the records. Receipts, invoices, closing statements. If you cannot show it, you usually cannot count it.

Which is why the work has to start before the sale, not after.

Every Sale Has a Different Answer

A fiduciary advisor can look at your situation before you sell — while there is still time to change the outcome.

How to Get Help Designing a Personalized Capital Gains Tax Strategy

Decisions that change the size of the bill have to be made before the sale. People who work with a fiduciary advisor — someone required to put their interests first — often keep more of what they built over the long run. The chart below shows how a guided strategy can compound over time.

Net worth from age 45 to 77 ($ thousands)

4550556065707577035070010501400
  • No Advisor
  • With Advisor

Illustrative example for educational purposes only. Assumes a starting portfolio and steady contributions; the “With Advisor” line assumes a coordinated, tax-aware withdrawal and rebalancing strategy. Actual results depend on contributions, returns, taxes, and timing. Not a guarantee of future performance.

What This Looks Like in Real Numbers

Here is a simple example. The numbers are made up, but the situation is very common.

Meet a couple in their sixties.

Twenty years ago they started putting money into a stock fund. Over those twenty years they put in $200,000 of their own money.

The fund paid dividends every year. Those dividends were automatically reinvested — used to buy more shares. Over twenty years that came to $110,000.

They paid income tax on those dividends every single year, as they received them.

Today the account is worth $850,000. They are ready to sell.

The wrong way to do the math

They look at what they put in — $200,000 — and subtract it.

Sale price$850,000
What they think they paid– $200,000
Taxable gain$650,000

The right way

The reinvested dividends were also money they paid in. They already paid tax on it once.

What they put in$200,000
Dividends reinvested+ $110,000
What they actually paid$310,000
Sale price$850,000
What they actually paid– $310,000
Taxable gain$540,000

The difference

Gain, wrong way$650,000
Gain, right way$540,000
Difference$110,000

At a combined long-term rate of 23.8% — the 20% top long-term rate plus the 3.8% net investment income tax — that difference works out to about $26,000.

Twenty-six thousand dollars. On money they had already paid tax on once.

And nothing here is a loophole. This is simply the correct number.

This example is for illustration only. It assumes a top long-term rate and does not include state tax, which varies widely. Your own rate depends on your income, your filing status, where you live, and how long you held the investment. Nothing here is tax advice.

Every Sale Has a Different Answer

A fiduciary advisor can look at your situation before you sell — while there is still time to change the outcome.

Why This Is Hard to Do Alone

Every one of these has rules attached. What counts, what does not, and how much — it depends on what you are selling, how long you held it, which account it sits in, and what the rest of your income looks like that year.

Your accountant files your return. That happens after the sale, when the number is already fixed.

The decisions that change the number happen before the sale.

That is a different job, and it usually needs a different person.

This is why many people who have built real wealth work with a fiduciary financial advisor — someone legally required to put your interests first — alongside their accountant, rather than instead of them.

Capital gains tax is one of the few large costs in your financial life that you still have some control over.

But only while you still own the thing.

If you are thinking about selling in the next year — an investment, a property, a business — it is worth having someone look at it first.

Every Sale Has a Different Answer

A fiduciary advisor can look at your situation before you sell — while there is still time to change the outcome.

Start Here

Answer a few questions and get matched with fiduciary financial advisors who serve your area.

Question 1 of 520%

Question 1

When are you thinking of selling or making a change?