How to Raise Your Cost Basis to $0 Tax: The 7-Year Strategy That Eliminates Embedded Capital Gains
May 29, 2026 · 13 min read

How to Raise Your Cost Basis to $0 Tax: The 7-Year Strategy That Eliminates Embedded Capital Gains

Every investor with a taxable brokerage account that has been held for more than a few years is carrying around a hidden tax bill they probably don't think about. The bill is the embedded capital gain — the difference between what the portfolio is worth today and what the investor originally paid for it. If a portfolio is worth $1.5 million with $500,000 in embedded long-term gains, the investor is sitting on roughly $119,000 in federal capital gains tax (at the 23.8% combined top rate) that will eventually come due whenever the positions are sold. The standard advice is to "hold and let it step up at death," which works only if the investor never needs to sell during their lifetime — never funds a child's tuition, never makes a major purchase, never weathers a medical event, never relocates or rebalances. In practice, most investors do sell during their lifetimes. The question is whether they sell with the embedded gain intact, or sell after a multi-year program of raising cost basis without paying tax has quietly eliminated most of the liability.

The strategy of raising cost basis without paying tax — sometimes called basis stepping or systematic basis elevation — uses two specific mechanisms working together over multiple years. The first is the 0% long-term capital gains bracket, available to households whose taxable income falls below the threshold ($98,900 for married couples filing jointly in 2026). The second is the matched pair: simultaneously realizing a gain and a harvested loss in the same tax year, sized so they offset each other for tax purposes. Used in combination across five to seven years (or longer), these techniques systematically reduce a portfolio's embedded gain toward zero, eliminating the eventual tax bill without ever requiring the investor to actually pay tax during the program. The strategy is not aggressive, not novel, and not subject to legal uncertainty — it's the natural consequence of how capital gains and losses interact in the federal tax code. What's required to execute it is sustained year-over-year attention to lot-level portfolio detail, the kind of attention that AI-driven portfolio management software handles routinely and human investors handle rarely.

This article walks through a full 7-year basis-raising program for a representative household, with a year-by-year table tracking exactly what happens to cost basis, embedded gain, and total portfolio value. The goal is to make the mechanics concrete enough that the strategy can be understood at the level of specific transactions, not just as an abstract concept.

The Starting Position

Consider David and Sarah, both 58, planning to retire around age 65. They live in Illinois. David's salary is $185,000 as a structural engineer; Sarah's is $95,000 as a nurse practitioner. They have two adult children, both financially independent. Their combined ordinary income places them in the 24% federal bracket, comfortably below the NIIT threshold of $250,000 in MAGI.

Their taxable brokerage portfolio at the start of 2026:

  • Total market value: $1,400,000
  • Total cost basis: $760,000
  • Embedded long-term capital gain: $640,000
  • Basis as a percentage of market value: 54.3%

The portfolio is well-diversified across 22 holdings — broad-market ETFs, sector funds, a few individual stocks they've held for decades, and some bond funds. The embedded gain is heavily concentrated in three positions accumulated through years of dollar-cost averaging starting in 2009 (the post-financial-crisis recovery years) and held through the long bull market.

If they were to sell the entire portfolio in 2026 to fund retirement, the tax bill would be: $640,000 × 18.8% (15% federal LTCG + 3.8% NIIT, since the realized gain would push MAGI well above $250,000) + roughly $640,000 × 4.95% Illinois state tax = $120,320 federal + $31,680 state = $152,000 in combined tax. They don't want to do this. But they do want to be able to draw from the portfolio in retirement without each withdrawal triggering meaningful tax. Their planner outlines a 7-year basis-raising program designed to substantially reduce the embedded gain before they retire.

The Plan in One Sentence

Each year for seven years: harvest losses continuously at the lot level across the full portfolio; in years when David and Sarah are still working (high-bracket years), bank the harvested losses and use them as offsets against intentional matched-pair gain realization; in years approaching and after retirement when their income drops, use available 0% bracket headroom for additional gain realization at zero tax. The goal: reduce embedded gain from $640,000 to below $100,000 by the end of year 7.

The 7-year program is designed to coincide with the structural change in their household income: years 1-5 are working years with full salaries, year 6 is the year David retires (Sarah continues working), year 7 is the year both have retired and household income drops significantly. This income gradient is what makes the strategy work — different years offer different specific opportunities, and the program is built around exploiting each year's specific tax position.

The Year-by-Year Walkthrough

Year 1 (2026): Working years, high bracket.

Household income: $280,000. Combined federal + state effective marginal rate on long-term gains: 19.95% (15% federal + 4.95% Illinois). No NIIT — MAGI just below the threshold.

Continuous lot-level harvesting captures $32,000 in realized losses across the year from normal market churn (lots that briefly dipped below their purchase price in various positions). The planner pairs $28,000 of those losses with $28,000 of intentional gain realization from the three highest-embedded-gain positions, repurchasing them at fresh higher cost basis. The remaining $4,000 of losses offsets $3,000 against ordinary income (the maximum annual deduction) and carries $1,000 forward.

End of year 1: Portfolio market value grew to roughly $1,505,000 with normal market appreciation. Cost basis raised to approximately $812,000 (the original $760,000 plus $28,000 from matched pairs plus the natural basis effect of harvest replacements plus contributions of about $30,000 across the year). Embedded gain: roughly $693,000.

But wait — the embedded gain actually went up, not down, because market growth outpaced the basis-raising. This is the most important and most often missed aspect of basis-raising programs: in years when the market rises faster than basis can be raised, the embedded gain grows in absolute terms even as the basis-raising work is happening. The strategy isn't about making the embedded gain shrink in absolute dollars — it's about preventing the embedded gain from growing as fast as it otherwise would, and steadily increasing basis-as-percentage-of-market-value over time.

Year 2 (2027): Working years, slightly higher income, modest market year.

Household income: $295,000 (raises, slight bonus increase). Market returns modest at +4%. Continuous harvesting captures $41,000 in losses (lots dipping below basis appearing throughout the year). The planner uses $38,000 of these against intentional gain realization in matched pairs. $3,000 against ordinary income.

End of year 2: Market value approximately $1,597,000 (4% growth + contributions). Basis raised to approximately $890,000. Embedded gain: $707,000. Basis as % of market: 55.7%.

Slow progress, but the trajectory is shifting. In a normal market year without active basis-raising, basis-as-% would have stayed flat or declined. The program is working — it's just working slowly.

Year 3 (2028): Working years, weak market.

Household income: $310,000. Market returns -8% for the year (a moderate correction). This is exactly the kind of year that turbocharges basis-raising programs, because harvestable losses are abundant.

Continuous harvesting captures $87,000 in realized losses during the year — many more lots underwater, larger losses available per lot. The planner uses $78,000 of these losses against intentional gain realization in matched pairs, raising basis substantially. The remaining $9,000 offsets $3,000 of ordinary income and banks $6,000 of carryforward.

End of year 3: Market value drops to roughly $1,490,000 (despite contributions, the -8% market dragged it down). But basis raised to approximately $968,000. Embedded gain: $522,000. Basis as % of market: 65.0%. The down market accelerated the program by a full year compared to what a flat market would have produced.

Year 4 (2029): Working years, strong recovery.

Household income: $315,000. Market recovers strongly at +18%. Continuous harvesting still captures meaningful losses — $28,000 — because lot-level scanning surfaces opportunities even in strong years (individual stocks and sectors that lag the broader recovery). The $6,000 banked carryforward plus the $28,000 current-year losses give the planner $34,000 to deploy in matched pairs.

End of year 4: Market value grows to roughly $1,793,000. Basis raised to approximately $1,032,000. Embedded gain: $761,000. Basis as % of market: 57.6%.

The strong market year produced large new gains but only modest basis-raising, because harvestable losses were scarce. This is the asymmetry that makes the strategy more valuable across cycles than in any single year — bad market years are basis-raising opportunities; good market years are growth years where the program runs in the background. Over time, the average outcome is steady basis elevation regardless of market conditions.

Year 5 (2030): Last working year for David.

Household income: $325,000 (David takes a half-year leave before retirement, but Sarah's salary plus part-year bonus keeps it high). Continuous harvesting captures $38,000 in losses across the year. The planner pairs $35,000 with intentional gain realization. $3,000 against ordinary income.

End of year 5: Market value approximately $1,895,000 (assume 5% market return + contributions). Basis raised to approximately $1,102,000. Embedded gain: $793,000. Basis as % of market: 58.2%.

Five years in, the absolute embedded gain has grown from $640,000 to $793,000 — but basis-as-% has held roughly stable while the portfolio has grown by 35%. Without the program, basis-as-% would have dropped sharply over the same period. The progress is real but not yet visible at the level of "embedded gain falling in dollars."

Year 6 (2031): David retires, Sarah continues working.

Household income: $128,000 (Sarah's salary + David's first year of pension + small Social Security since David is 64). For the first time, the household drops into a much lower tax bracket. Taxable income after standard deduction: approximately $96,000. They are now well inside the 15% LTCG bracket, and approaching the 0% bracket boundary at $98,900 of taxable income.

This is the year the strategy shifts into higher gear. Continuous harvesting still captures $34,000 in losses across the year. The planner now has multiple options:

  1. Match $28,000 in matched pairs as before
  2. Realize an additional $3,000 in long-term gains inside the 0% bracket (the headroom from $96,000 to $98,900)
  3. Bank the remaining $3,000 in losses for next year

End of year 6: Market value approximately $1,985,000. Basis raised to approximately $1,165,000 (matched pairs + 0% bracket fill + replacements). Embedded gain: $820,000. Basis as % of market: 58.7%.

Year 7 (2032): Full retirement year, low income.

Household income: $98,000 (Social Security combined + David's pension + small Sarah part-time consulting). Taxable income after standard deduction: approximately $66,000. The household has $32,900 of headroom inside the 0% bracket ($98,900 − $66,000).

The planner executes the largest basis-raising action of the program:

  • Realize $32,900 of long-term gains by selling and immediately repurchasing positions with embedded gains, all inside the 0% bracket — federal tax: $0
  • Continuous harvesting captures $42,000 in losses across the year (a moderate market dislocation in mid-year produces abundant opportunities)
  • $36,000 of those losses match against an additional $36,000 of intentional gain realization beyond the 0% headroom — net tax on that portion: $0 (matched pair offset)
  • Total basis raised this year: $68,900

End of year 7: Market value approximately $2,065,000. Basis raised to approximately $1,254,000. Embedded gain: $811,000. Basis as % of market: 60.7%.

What the 7-Year Table Shows

| Year | Market Value | Cost Basis | Embedded Gain | Basis as % of MV | |------|-------------|-----------|---------------|-----------------| | Start | $1,400,000 | $760,000 | $640,000 | 54.3% | | 1 (2026) | $1,505,000 | $812,000 | $693,000 | 53.9% | | 2 (2027) | $1,597,000 | $890,000 | $707,000 | 55.7% | | 3 (2028) | $1,490,000 | $968,000 | $522,000 | 65.0% | | 4 (2029) | $1,793,000 | $1,032,000 | $761,000 | 57.6% | | 5 (2030) | $1,895,000 | $1,102,000 | $793,000 | 58.2% | | 6 (2031) | $1,985,000 | $1,165,000 | $820,000 | 58.7% | | 7 (2032) | $2,065,000 | $1,254,000 | $811,000 | 60.7% |

Total federal tax paid across the 7-year program: approximately $2,200 (small NIIT and bracket effects in a couple of years where matched pairs didn't perfectly offset).

The headline observation: basis-as-percentage moved from 54.3% to 60.7% over seven years, including one strong recovery year that worked against the program. The progress looks modest, but the absolute basis-raising — the total dollar amount of basis added to the portfolio — was $494,000, all at near-zero net tax cost.

The eventual tax savings when this portfolio is eventually drawn down in retirement, compared to a do-nothing alternative:

  • Do-nothing alternative: portfolio held until age 80, drawn down over 10 years to fund late retirement. Embedded gain at start of drawdown: approximately $1,200,000 (with continued market growth). Eventual tax: $1,200,000 × ~20% effective combined rate = $240,000.

  • Basis-raised portfolio: same drawdown, but embedded gain at start is approximately $400,000-$500,000 (the program continues running during the early retirement years, further reducing embedded gain). Eventual tax: $400,000 × ~15% (lower bracket in retirement) = $60,000.

Net lifetime tax savings: approximately $180,000.

This is the value the 7-year program produces — paid for with $2,200 in tax during the program itself.

Why the Progress Looks Slow in Any Single Year

The most common reaction to a basis-raising program in years 1-3 is impatience. The embedded gain in absolute dollars isn't shrinking — it's often growing because the market is growing faster than the basis-raising can keep up. The basis-as-% number is moving slowly. The casual observer concludes the strategy isn't working.

This misreads the math. The strategy isn't designed to reduce embedded gain in absolute dollars during years when the market is strong. It's designed to prevent embedded gain from growing as fast as it otherwise would, while gradually shifting basis-as-% upward. Over a 7-year cycle that includes at least one weak market year, the strategy produces dramatic acceleration in basis-raising during the weak years (year 3 in David and Sarah's case) that compounds the slow progress in strong years. By the end of the cycle, basis-as-% has shifted meaningfully and the eventual tax bill has been reduced.

The same logic applies even more strongly for longer programs. A 15-year basis-raising program executed across a typical market cycle (3-4 weak years, 11-12 normal/strong years) produces basis-as-% improvements of 25-35 percentage points and embedded gain reductions of $400,000-$700,000 on a portfolio of David and Sarah's size. The strategy compounds dramatically over time precisely because individual years contribute modestly and the cumulative effect adds up only across many years.

Why Most Investors Can't Run This Program Manually

The execution requirements are real:

  • Lot-level scanning of the full portfolio every market day to surface harvestable losses as they appear
  • Calculation of available 0% bracket headroom each year based on projected income
  • Identification of matched pair opportunities — gain positions to sell, loss positions to harvest, sized to neutralize tax exactly
  • Wash sale tracking across all accounts including IRAs and spouse accounts
  • Replacement security selection to maintain market exposure while avoiding substantially identical positions
  • Tracking the new cost basis on every replacement purchase for the next round of optimization
  • Adjusting strategy in response to mid-year income changes, market movements, and unexpected events

A capable accountant or financial planner running the program manually can approximate the strategy at the level of "harvest losses in December and execute one or two matched pairs per year." That captures maybe 15-25% of the available value. Capturing the full value requires continuous attention that no individual professional can sustain across multiple clients.

This is the operational case for AI-driven portfolio management software handling the execution layer. The strategy itself isn't proprietary — anyone who reads this article understands the mechanics. What's proprietary, and what determines whether the strategy actually produces the values the math suggests, is the execution infrastructure that scans continuously, calculates precisely, and acts within the relevant time windows. Software handles all of this as routine background processing. Humans handle it imperfectly, when they handle it at all.

For background on the rate brackets that determine the value of basis-raising, see capital gains tax rates 2026. For the NIIT mechanics that especially affect higher-income years in the program, see net investment income tax NIIT 2026. The matched pair mechanics that drive Components 2 of the strategy are covered in detail in our matched pairs deep dive. For specific retiree applications, see tax loss harvesting for retirees and the retiree's zero-tax gain case study. For high-income business owners running similar multi-year programs across variable income years, see tax loss harvesting for business owners. The continuous lot-level harvesting that feeds the basis-raising program is detailed in our 20-year case study comparing regular harvesting to market timing and the unrealized losses hiding in your winners deep dive.

Raising cost basis without paying tax isn't a financial trick or aggressive tax strategy. It's the deliberate, sustained application of the tax code's own rules across multiple years, exploiting the natural offset between realized gains and realized losses to shift a portfolio's embedded characteristics over time. The math is straightforward. The execution is unforgiving. Investors who run this program — or who use software that runs it for them — end up with portfolios whose eventual tax bills are a fraction of what they would otherwise be, paying for the entire program with savings that compound over decades.

Stop overpaying — get started free →