Matched Pairs: How to Realize Capital Gains Without Paying Tax
May 9, 2026 · 11 min read

Matched Pairs: How to Realize Capital Gains Without Paying Tax

The standard description of tax loss harvesting goes like this: sell a position at a loss, replace it with a similar position to maintain market exposure, and bank the loss for future use against capital gains. The investor's portfolio looks essentially the same the next day, but they now have a realized loss available to offset gains they realize elsewhere — this year, next year, or anytime in the future. This is the textbook strategy. It works. It's also incomplete.

The matched pair strategy turns the textbook approach inside out. Instead of harvesting a loss and saving it for future use, you harvest a loss and a gain simultaneously, sized so they offset each other within the same tax year. The two transactions cancel for tax purposes — net taxable gain: zero. But economically, something significant has happened. The gain position has been sold and immediately repurchased at a higher cost basis, permanently raising its basis without any tax cost. The loss position has been sold and replaced with a correlated substitute, maintaining market exposure. The portfolio's total market value is unchanged. The portfolio's embedded tax liability has dropped by the size of the matched gain — typically by thousands or tens of thousands of dollars per pair.

This is the mechanic that lets investors realize capital gains without paying tax. It's not aggressive, it's not novel, and it's not a loophole. It's the natural arithmetic consequence of the way capital gains and losses interact in the tax code: they offset each other dollar for dollar within the same year, and the cost basis of replacement positions resets to current market value. Apply that arithmetic intentionally and at scale, year after year, and the portfolio's embedded tax liability shrinks toward zero while market exposure stays constant.

What Is a Matched Pair, Mechanically?

A matched pair is two simultaneous transactions in the same tax year:

  1. The sale of a position with an unrealized gain
  2. The sale of one or more positions with unrealized losses, sized to offset that gain

The gain transaction triggers a taxable capital gain. The loss transaction generates a deductible capital loss of equal size. On the tax return, the two combine to produce zero net taxable gain. The investor pays no tax on the realized gain, even though the realization itself was real and intentional.

After the sales, the investor immediately repurchases both sides of the pair. The gain position is bought back at its current market price — establishing a new, higher cost basis. The loss position is replaced with a correlated but not substantially identical security, to avoid the wash sale rule. The replacement maintains market exposure to the same asset class. The investor's portfolio at end of day looks essentially identical to its starting state in terms of holdings and exposure. What's changed is the tax characteristics: the gain position now has a much higher cost basis, eliminating embedded gain dollar for dollar.

Worked example. An investor owns two positions:

  • Position A: 500 shares of an S&P 500 ETF, purchased in 2018 at $250 per share, currently $400. Cost basis: $125,000. Market value: $200,000. Unrealized gain: $75,000.
  • Position B: 300 shares of an emerging markets ETF, purchased in 2021 at $80 per share, currently $30. Cost basis: $24,000. Market value: $9,000. Unrealized loss: $15,000.

In a matched pair transaction, the investor sells 100 shares of Position A and all 300 shares of Position B simultaneously. The Position A sale generates 100 × ($400 − $250) = $15,000 in long-term capital gains. The Position B sale generates $15,000 in capital losses. Net taxable gain: zero. Federal tax owed: zero.

The investor immediately buys 100 shares of the same S&P 500 ETF at $400, establishing a new cost basis of $40,000 on those 100 shares (versus the $25,000 basis they had before). Embedded gain on those shares: now zero. The investor also buys 300 shares of a different emerging markets ETF — say, swapping VWO for IEMG, two distinct funds tracking similar but not substantially identical indices — at $30, establishing a fresh $9,000 cost basis with no embedded gain or loss.

Before the trade: $200,000 in market exposure with $75,000 of embedded gain in Position A. After the trade: $200,000 in market exposure with $60,000 of embedded gain in Position A (the remaining 400 shares) and $0 of embedded gain in the new 100 shares. Total embedded gain has dropped by $15,000, and the investor paid $0 in tax to make that happen.

If the investor's eventual long-term tax rate on Position A would have been 23.8% (top federal bracket plus NIIT), the $15,000 reduction in embedded gain represents $3,570 of permanently avoided future tax. Per pair. Per year that this technique is applied.

Why Most Investors Don't Do This

The matched pair strategy is conceptually simple but operationally demanding. To execute one well, an investor needs to know — for every position in their portfolio — the current cost basis at the lot level, the unrealized gain or loss, the holding period, and how each position's sale would interact with the year-end tax picture. They need to coordinate the timing of both sides of the pair so they fall in the same tax year. They need to identify a correlated replacement security for the loss side that won't trigger wash sale issues. And they need to track the new cost basis on every replacement purchase for the next round of optimization.

This is achievable manually for an investor with, say, three or four positions. Past that, the bookkeeping becomes overwhelming. A typical 30-position portfolio with multiple lots per position contains hundreds of potential matched pairs at any given moment — most of them too small to be worth executing manually, but valuable in aggregate when handled by software that doesn't tire of small transactions. This is where Capability #4 of TaxHarvest fits: the system continuously scans for matchable gain/loss combinations across the full portfolio, sizes the pairs to neutralize tax exactly, executes both legs in the same trading session, and tracks the basis updates for future rounds.

The reason most investors don't use matched pairs isn't that the strategy is complicated to understand. It's that the strategy is impossible to execute well without lot-level visibility and continuous monitoring. Both of those, until recently, were the exclusive province of institutional investors and ultra-high-net-worth advisory programs. The technology to apply matched pairs to retail-scale portfolios is what changed.

When to Spend Losses Versus Bank Them

The deeper question matched pairs raise is strategic: when should an investor spend harvested losses on offsetting gains in the same year, versus banking the losses for future use?

The answer depends on the investor's likely future tax rate compared to their current rate. Realized losses in a taxable account don't expire — they carry forward indefinitely at the federal level, available to offset gains in any future year (with up to $3,000 per year usable against ordinary income). Banking a loss is functionally equivalent to receiving an option that can be exercised whenever it has the most value. If the investor expects to be in a higher tax bracket in future years, banking the loss is better — the loss is worth more when offset against gains taxed at the higher rate.

Three situations argue for spending losses now via matched pairs rather than banking them:

The investor's current rate equals or exceeds expected future rates. A high-income executive expecting to retire in five years and drop into the 0% LTCG bracket in retirement should generally spend losses now while they're worth 23.8%, not bank them for use against gains that would be taxed at 0% anyway. The same logic applies to anyone with unusually high current income that's expected to normalize lower.

The portfolio has large embedded gains that need to be unwound. An investor with concentrated stock from RSUs, an inherited position, or decades of buy-and-hold has a real risk that emergencies — medical care, divorce, large purchases — force liquidation at full capital gains rates. Matched pairs let them gradually unwind embedded gains during years when offsetting losses are available, smoothing the tax exposure over time rather than facing it all at once when forced. This is the dominant rationale for matched pairs in concentrated-position portfolios.

The losses are short-term, the gains are long-term. Short-term capital losses first offset short-term gains, but if there are no short-term gains, they then offset long-term gains. A short-term loss is more valuable to an investor with short-term gains, but if there are none, it can be "spent" against a long-term gain in a matched pair. If the investor banks the loss instead, it might end up offsetting only a long-term gain in the future — losing the marginal benefit of being short-term in nature. Spending it now preserves more of its theoretical maximum value.

The reverse situations argue for banking. If the investor expects to be in a higher bracket later, if they have no embedded gains they need to address, or if they're confident they'll have meaningful realized gains in future years that need offsetting, banking the loss is optimal. There's no universal answer. The question depends on the investor's specific situation, and changes year to year as circumstances evolve.

A Multi-Year Pattern: How Matched Pairs Compound

The single-pair example above shows $3,570 of avoided future tax. A multi-year program that runs matched pairs continuously produces dramatically larger outcomes.

Worked example. Consider an investor with a $1.2 million taxable portfolio containing $400,000 of embedded long-term gains accumulated over 15 years of holding. The investor is married, files jointly, has $290,000 in household income, and expects to remain in approximately the same tax situation for the next decade. Their long-term capital gains rate is 18.8% (15% federal LTCG + 3.8% NIIT).

Without intentional unwinding, the $400,000 in embedded gains represents an eventual tax liability of $400,000 × 18.8% = $75,200, payable whenever the investor sells the positions. If markets continue to grow, the embedded gain — and the embedded liability — continues to grow with them.

With a continuous matched pair program, the investor's portfolio generates roughly $30,000 to $50,000 per year in harvested losses through normal market volatility (varies by year). Of that, perhaps $25,000 to $35,000 per year can be paired with intentional gain realization in the same portfolio. Over five years, that's $125,000 to $175,000 of embedded gain unwound without any tax cost. Over ten years, virtually the entire $400,000 of embedded gain can be eliminated via matched pairs, assuming continued normal market behavior.

The endgame is a portfolio with the same market value but cost basis approximately equal to current market value. The embedded tax liability has been reduced from $75,200 to near zero, paid for entirely by the matching of natural market losses against intentional gain realizations. The investor never wrote a tax check for any of this.

Compare this to the alternative path: hold the positions until forced to sell, pay $75,200 (or more, if the portfolio appreciates further), and lose the time value of that money. The matched pair approach doesn't avoid economic value transfer to the IRS; the gains were realized intentionally, and the losses were realized intentionally. What it avoids is the combined tax bill on those realizations, by ensuring they happen within the same year so they offset.

The Wash Sale Coordination Problem

The single biggest execution challenge in matched pair strategies is the wash sale rule on the loss side. The IRS will disallow a loss if a "substantially identical" security is purchased within 30 days before or after the loss sale. For matched pairs to work, the replacement security on the loss side must be correlated enough to maintain market exposure but distinct enough to clear the wash sale test.

For broad-market index ETFs, this is straightforward — there are multiple ETFs tracking similar but not identical indices in nearly every major asset class. An S&P 500 fund can be replaced with a Russell 1000 or Total Market fund. An MSCI EAFE international fund can be replaced with an FTSE Developed Markets fund. The distinct underlying indices clear the substantially identical test under standard tax treatment.

For individual stocks, there is no good substitute. A specific company's stock is substantially identical only to itself. Holding individual stocks limits matched pair flexibility because the loss side has no clean replacement option — the investor must either accept 30 days of being out of the position, or restructure the trade to use a sector ETF or correlated stock as a temporary substitute.

For investors with concentrated stock positions — RSU holdings, inherited stock, founder shares — this is one reason direct indexing or factor-based ETF portfolios produce much better matched pair outcomes than concentrated single-stock portfolios. The replacement flexibility makes the strategy mechanically simpler and more frequently executable.

What Matched Pairs Aren't

A matched pair is not a tax dodge, not a loophole, and not a strategy that requires aggressive interpretation of any tax rule. The investor is realizing actual gains and actual losses, all of which appear on the tax return as the IRS expects them to. The "magic" is purely the timing — when gains and losses fall in the same year, they offset, and that's exactly the rule Congress wrote.

Matched pairs are also not a way to permanently avoid all capital gains tax forever. They reduce the embedded liability inside a portfolio over time, but only to the extent that natural market volatility produces harvestable losses to match against. In a perfectly steady bull market with no drawdowns, no losses would be available to harvest, and matched pairs couldn't run. In practice, real markets always produce sufficient volatility — even strong years contain enough sector rotation and individual stock movement to generate harvestable losses inside any diversified portfolio.

Finally, matched pairs are not a substitute for the broader tax loss harvesting strategy. They are a specific application of harvested losses, alongside the standard application of banking losses for future use. Most well-run TLH programs blend the two: in years where the investor has no current-year gains to offset and expects future gains to materialize, losses are banked. In years where the investor wants to unwind embedded gains, losses are spent via matched pairs. The same harvested loss can serve either purpose, depending on what the investor needs in that specific year.

For background on the rate brackets that determine the value of matched pairs in different income situations, see capital gains tax rates 2026. For investors above the NIIT threshold, the value of every matched pair is amplified by 3.8% — see our net investment income tax NIIT 2026 explainer. For retirees specifically, the matched pair strategy combines with the 0% LTCG bracket to permanently eliminate embedded gains; see tax loss harvesting for retirees. The lot-level scanning that makes matched pairs operationally feasible is covered in our unrealized losses hiding in your winners deep dive, and the broader compounding case is laid out in Marcus's $600,000 portfolio scenario.

Most investors think of tax loss harvesting as a defensive technique — a way to cushion bad years by extracting tax value from positions that didn't work out. Matched pairs reframe it as something else entirely: an active tool for restructuring a portfolio's embedded tax characteristics, year by year, until the gains an investor has been carrying around for a decade or more can be realized without writing a single check to the IRS. The strategy was always available in principle. The technology to execute it well, at scale, on retail-sized portfolios is what's new.

Stop overpaying — get started free →