Capital Gains Harvesting Calculator
Optimize realized gains to take advantage of the 0% long-term capital gains bracket
Educational purposes only. This calculator is for informational purposes and should not be considered financial, tax, or legal advice. Consult a qualified professional for personalized guidance.
Examples use hypothetical values. Actual returns and market conditions will vary.
Tax Situation
Positions with Unrealized Gains
Gains by Position
Educational purposes only. Tax laws are complex and vary by jurisdiction. This calculator uses 2024 federal brackets and does not account for state taxes, AMT, NIIT, or personal circumstances. Consult a tax professional before implementing any tax strategy.
How This Tool Works
Capital Gains Harvesting Calculator
Capturing Tax-Free Investment Gains
Capital gains harvesting represents one of the most powerful yet underutilized tax strategies available to individual investors. When your taxable income falls below certain thresholds, you can realize long-term capital gains at a 0% federal tax rate, essentially locking in profits without any immediate tax cost. The capital gains harvesting calculator identifies how much "room" you have in the 0% bracket and which positions offer the best harvesting opportunities.
Most investors focus exclusively on tax-loss harvesting, selling losers to offset winners. But gain harvesting works in reverse during low-income years. By strategically realizing gains when your income is low enough to qualify for the 0% rate, you reset your cost basis higher, reduce future tax liability, and capture the profit permanently at no federal tax cost. This strategy turns low-income years from financial setbacks into tax optimization opportunities.
Tax-efficient investors harvest both losses and gains depending on their annual tax situation.
The 0% Long-Term Capital Gains Bracket
The federal tax code provides three rate tiers for long-term capital gains: 0%, 15%, and 20%. The 0% rate is not merely symbolic; it applies to substantial amounts of income for many taxpayers. For 2024, single filers can realize long-term gains tax-free on total taxable income up to approximately $47,025, while married couples filing jointly enjoy the 0% rate up to roughly $94,050. Head of household filers fall between these thresholds at approximately $63,000.
These thresholds include all taxable income, not just capital gains. If your ordinary income from wages, interest, and other sources is $35,000 and you are single, you have approximately $12,000 of "room" in the 0% bracket. Any long-term capital gains realized up to that room amount face zero federal tax.
The calculator determines your available room based on filing status and ordinary income, then identifies which positions can be harvested within that space.
The Mechanics of Gain Harvesting
The gain harvesting strategy involves selling appreciated positions to realize gains, then immediately repurchasing the same securities. Unlike tax-loss harvesting, there is no wash sale rule for gains. You can sell and rebuy the identical security the same day, capturing the tax-free gain while maintaining your market position.
After the transaction, your cost basis resets to the new purchase price. If you bought shares at $100 that are now worth $150, selling and rebuying resets your basis to $150. When you eventually sell at $180 in retirement, you are taxed only on the $30 gain since the harvest, not the full $80 gain from original purchase. The $50 per share harvested during your low-income year was captured tax-free.
Transaction costs are the primary friction. Commission-free brokers have largely eliminated this concern, but bid-ask spreads on less liquid securities can reduce the benefit. For highly liquid ETFs and large-cap stocks, these costs are negligible compared to the tax savings.
Identifying Optimal Harvest Candidates
Not all positions offer equal harvesting value. The calculator analyzes your portfolio to prioritize positions based on several factors that maximize the strategy's benefit.
Unrealized gain percentage matters because positions with larger embedded gains offer greater tax savings potential. A position showing 100% gain provides twice the harvestable gain per dollar of market value compared to a 50% gain position.
Holding period must exceed one year for long-term treatment. Short-term gains do not qualify for the 0% rate; they are taxed as ordinary income regardless of total income level. The calculator separates long-term positions from short-term to identify only eligible candidates.
Position size affects how completely you can utilize available bracket room. Large positions might require partial sales to avoid exceeding the 0% threshold, while smaller positions might be harvested entirely.
The calculator ranks positions by these factors and generates a specific harvest plan showing exactly how many shares to sell from each position.
When Gain Harvesting Makes Sense
Low-income years present the primary opportunity. Sabbaticals, between-job transitions, early retirement before Social Security begins, part-time work years, or years when most income comes from Roth distributions all create potential 0% bracket room.
Married couples where one spouse stops working temporarily may find significant room opens up, especially if the working spouse has modest income. Graduate school years, parental leaves, or career transitions often create these opportunities.
Year-before-high-income situations also warrant consideration. If you expect a major liquidity event like stock option exercises or business sale next year, harvesting gains this year at 0% rather than next year at 15% or 20% captures permanent savings.
The calculator helps identify these opportunities by showing exactly how much room exists and the tax savings from utilizing it.
Important Considerations and Limitations
State taxes complicate the picture. Most states do not offer preferential long-term capital gains rates, instead taxing gains as ordinary income. Harvesting that is free at the federal level might still trigger state tax liability. California residents in particular should factor in state rates up to 13.3% before pursuing aggressive harvesting.
Affordable Care Act subsidy eligibility uses modified adjusted gross income that includes capital gains. Harvesting gains can increase MAGI and potentially reduce healthcare premium subsidies or increase premium costs. For those relying on ACA subsidies, the interaction requires careful analysis.
Social Security benefit taxation can be affected by capital gains. Up to 85% of Social Security benefits become taxable when provisional income exceeds certain thresholds, and capital gains count toward that calculation. Retirees receiving Social Security should model the interaction before harvesting.
Medicare premium surcharges (IRMAA) apply higher premiums when modified adjusted gross income exceeds certain thresholds. Large capital gains harvests can trigger IRMAA for the following two years.
Calculating Optimal Harvest Amounts
The calculator determines the precise amount to harvest by first calculating your available room in the 0% bracket based on ordinary income and filing status. It then analyzes each long-term position to determine how much gain is embedded.
For each position, the calculator shows the unrealized gain, the number of shares you could sell to harvest a specific gain amount, and the tax savings compared to realizing those gains at 15% or 20% rates in future years.
If your total long-term gains exceed your bracket room, the calculator prioritizes positions with the highest gain percentages to maximize tax savings within available room.
Executing the Strategy
After identifying harvest candidates, execution is straightforward. Sell the indicated shares of each position, then immediately submit buy orders for the same securities. For most positions, same-day execution maintains virtually identical market exposure.
Record keeping is essential. Document your new cost basis for each position after harvesting. Brokerage statements typically reflect the new basis after purchases settle, but maintaining your own records ensures accuracy at future sale.
Consider transaction timing. Selling and rebuying intraday avoids overnight market risk. For less liquid securities, limit orders prevent unfavorable execution prices.
Long-Term Impact of Systematic Harvesting
Consistent annual harvesting compounds over time. An investor who harvests $10,000 of gains annually at 0% rather than eventually paying 15% saves $1,500 per year in future taxes. Over 20 years, that represents $30,000 in tax savings, before considering growth on those retained funds.
The strategy works best for investors building wealth during accumulation years who anticipate eventually selling in higher tax brackets. By harvesting gains during low-income years and resetting basis upward, you permanently eliminate tax on those gains.
Capital gains harvesting transforms low-income years from financial challenges into tax optimization opportunities. By realizing long-term gains while income remains below the 0% threshold, you capture investment profits tax-free and reset cost basis for future sales. The calculator identifies your available bracket room, prioritizes harvest candidates, and quantifies the tax savings from this powerful but often overlooked strategy.
Related Tools
Position Sizing Calculator
Calculate optimal position size based on risk
Volatility Position Sizing Calculator
Size positions based on ATR or volatility to adapt to market conditions
Risk/Reward Ratio Calculator
Calculate risk/reward ratio for trades
Stop Loss Calculator
Calculate the stop loss price based on your risk tolerance