Tax Gain Harvesting Calculator
Low-income year? Sell your winners at 0% capital gains tax and reset your cost basis for free.
Filing Status & Income
Long-Term Gains to Harvest
Future Tax Comparison (optional)
Used to estimate the present value of resetting your cost basis. If you harvest at 0% now, you avoid paying the future rate on these gains.
Tax Gain Harvesting: The Complete Guide
Everything you need to know about realizing capital gains tax-free in low-income years, resetting your cost basis, and building long-term tax efficiency.
Tax gain harvesting is the strategy of intentionally selling appreciated investments during years when your income is low enough that the resulting long-term capital gains fall into the 0% federal tax bracket. After selling, you immediately repurchase the same investment, resetting your cost basis to the current (higher) market value without paying any capital gains tax.
This is the mirror image of tax-loss harvesting:
- Tax-loss harvesting — You sell losers to realize losses and reduce your tax bill. You must wait 31 days before repurchasing the same security (wash sale rule).
- Tax gain harvesting — You sell winners to realize gains at 0% tax. There is no wash sale restriction on gains, so you can sell and immediately buy back the same stock on the same day.
Why it works: The U.S. tax code taxes long-term capital gains at three rates: 0%, 15%, and 20%. The 0% rate applies to taxable income up to certain thresholds. For 2024, single filers pay 0% on LTCG if their total taxable income (including gains) is below $47,025. For married couples filing jointly, the threshold is $94,050.
The key benefit: By realizing gains at 0% tax, you permanently eliminate the built-in tax liability on those shares. When you repurchase immediately, your new cost basis equals the current market price. If you later sell those shares at a higher price, you only owe tax on the additional appreciation above the reset basis — not the original lower basis.
Tax gain harvesting is particularly valuable for people experiencing a temporary or sustained period of low taxable income. The common scenarios include:
- Early retirees living off savings — Between retiring early and claiming Social Security or drawing from traditional retirement accounts, many early retirees have very low taxable income. This is often the golden window for gain harvesting.
- Gap years or sabbaticals — If you take a year off from work, your W-2 income drops to zero. Even with some investment income, you may fall well below the 0% LTCG threshold.
- Students or people returning to school — Full-time students with minimal income can harvest gains from taxable brokerage accounts at 0%.
- Job transitions or layoffs — A partial year of employment means lower annual income. If you were laid off in March and started a new job in October, your total income for the year may be low enough.
- Self-employed people in a down year — Business income fluctuates. A year with low business profits creates room in the 0% bracket.
- Married couples with one earner — The MFJ threshold is $94,050, which provides substantial room for gain harvesting if only one spouse is working or if both earn modest incomes.
The general rule: If your taxable income (after the standard deduction, before adding LTCG) is well below the 0% bracket ceiling, you have room to harvest gains for free. The farther below the threshold you are, the more gains you can realize at 0%.
The calculation involves stacking your income in the right order to determine how much room remains in the 0% long-term capital gains bracket. Here is the step-by-step process:
- Step 1: Calculate taxable ordinary income. Start with your gross ordinary income (wages, self-employment, rental income, interest, etc.) and subtract the standard deduction (or itemized deductions if higher). For 2024, the standard deduction is $14,600 for single filers and $29,200 for married filing jointly.
- Step 2: Find the 0% bracket ceiling. For 2024, the 0% LTCG rate applies up to $47,025 of total taxable income for single filers, $94,050 for MFJ, $63,000 for head of household, and $47,025 for MFS.
- Step 3: Calculate the room. Subtract your taxable ordinary income from the 0% ceiling. This is the total amount of preferential income (qualified dividends + LTCG) that can be taxed at 0%.
- Step 4: Subtract qualified dividends. Qualified dividends also get preferential tax rates and fill the 0% bracket before your LTCG. Subtract your qualified dividends from the room calculated in Step 3. The remainder is the amount of LTCG you can harvest at 0%.
Example: A single filer earns $30,000 in wages with $2,000 in qualified dividends. Taxable ordinary income = $30,000 − $14,600 = $15,400. Room in 0% bracket = $47,025 − $15,400 = $31,625. After qualified dividends: $31,625 − $2,000 = $29,625 in LTCG realizable at 0%.
This calculator automates the entire process. Just enter your income figures and it computes the optimal harvest amount instantly.
Cost basis is the original purchase price of an investment, used to calculate your capital gain or loss when you sell. When you sell an appreciated asset and repurchase it, your cost basis resets to the repurchase price.
How the step-up works in tax gain harvesting:
- You bought 100 shares at $50/share. Cost basis = $5,000.
- Shares are now worth $80/share. Current value = $8,000. Unrealized gain = $3,000.
- You sell all shares in a low-income year at 0% LTCG tax. You pay $0 in tax on the $3,000 gain.
- You immediately repurchase 100 shares at $80/share. New cost basis = $8,000.
The future benefit: If you later sell those shares at $120/share, your gain is $120 − $80 = $40 per share ($4,000 total). Without the harvest, your gain would have been $120 − $50 = $70 per share ($7,000 total). By harvesting, you permanently eliminated $3,000 of taxable gains.
At a future 15% rate: That $3,000 basis step-up saves you $450 in future capital gains tax. At 20% + 3.8% NIIT, it saves $714. The higher your expected future tax rate, the more valuable the step-up becomes.
Compounding benefit: The tax you would have paid stays invested and compounds over time. If you invest the $450 in tax savings at 8% annual returns for 20 years, it grows to approximately $2,097. Tax gain harvesting is not just about this year — it is about decades of compounded tax-free growth on money that would have gone to the IRS.
Yes! Unlike tax-loss harvesting, there is no wash sale rule for gains. The wash sale rule (IRS Section 1091) only applies when you sell a security at a loss and repurchase a substantially identical security within 30 days. It does not apply to sales at a gain.
This means you can:
- Sell your appreciated shares at a gain.
- Immediately place a buy order for the exact same security — even on the same day.
- Your new cost basis is the repurchase price.
- You maintain the same position with zero time out of the market.
Practical considerations:
- Transaction costs — Most brokerages offer commission-free stock and ETF trades, so the round-trip sell/buy costs nothing. However, check if your specific securities have any trading fees.
- Bid-ask spread — For widely traded stocks and ETFs, the spread is negligible (often under a penny per share). For thinly traded securities, the spread could eat into your tax savings.
- Holding period resets — When you repurchase, your holding period starts over. The shares are now short-term until you hold them for more than one year again. Keep this in mind if you might sell again soon.
The ability to immediately repurchase is what makes tax gain harvesting so powerful. You stay fully invested, pay no tax, and lock in a higher cost basis for the future.
Qualified dividends are taxed at the same preferential rates as long-term capital gains (0%, 15%, or 20%). Crucially, they share the same bracket space with LTCG. This means qualified dividends fill up the 0% bracket before your long-term capital gains do.
How the stacking works:
- First, your taxable ordinary income (wages minus deductions) sets the floor.
- Next, qualified dividends stack on top of ordinary income and begin filling the 0% LTCG bracket.
- Finally, long-term capital gains stack on top of qualified dividends.
Example: Single filer with $20,000 taxable ordinary income and $10,000 in qualified dividends. The 0% bracket ceiling is $47,025. Room after ordinary income: $47,025 − $20,000 = $27,025. After qualified dividends: $27,025 − $10,000 = $17,025 available for LTCG at 0%.
High-dividend portfolios: If you hold dividend-heavy stocks or funds, your qualified dividends can significantly reduce the amount of LTCG you can harvest at 0%. This is especially relevant for investors with large positions in dividend aristocrats or high-yield ETFs. You may want to account for estimated annual qualified dividends when planning how much to harvest.
Non-qualified dividends (from REITs, money market funds, etc.) are taxed as ordinary income and do not compete with your LTCG for the 0% bracket space. They would, however, increase your taxable ordinary income floor.
The Net Investment Income Tax (NIIT) is a 3.8% surtax on investment income that applies to taxpayers with modified adjusted gross income (MAGI) above certain thresholds. It was introduced by the Affordable Care Act and applies on top of regular capital gains rates.
NIIT thresholds:
- Single or Head of Household: $200,000
- Married Filing Jointly: $250,000
- Married Filing Separately: $125,000
The 3.8% tax applies to the lesser of: (1) your net investment income, or (2) the amount by which your MAGI exceeds the threshold. Net investment income includes capital gains, dividends, interest, rental income, and certain other passive income.
Impact on gain harvesting: For most people who benefit from tax gain harvesting, the NIIT does not apply because their income is well below the thresholds. If your total AGI (including the realized gains) is under $200,000 ($250,000 for MFJ), the NIIT does not kick in.
However, if you have a large amount of unrealized gains and realize them all at once, you could push your AGI above the NIIT threshold even in a "low income" year. In that case, the NIIT applies to the portion above the threshold. This calculator flags when NIIT applies and includes it in the total tax calculation.
The best time to execute a tax gain harvest depends on your confidence in your annual income and the timing of any income changes. Here are the key considerations:
- Late in the year (October-December) — By Q4, you have a much clearer picture of your total annual income. You know your W-2 wages, business income, and dividend distributions. This reduces the risk of accidentally pushing yourself into the 15% bracket by misjudging income. Most advisors recommend waiting until you have strong visibility into your full-year income.
- Before year-end dividend distributions — Mutual funds and ETFs often distribute capital gains in December. These distributions can unexpectedly push your income higher. Ideally, do your gain harvest before large distributions are declared.
- After a large market run-up — If the market has been strong and your positions have large unrealized gains, harvesting locks in the basis step-up at the high price. If the market later pulls back, your new basis is already set at the peak.
- During job transitions — If you know you are leaving a job mid-year and will have lower income, plan the harvest for the low-income period. Do the math early to see how much room you will have in the 0% bracket.
Annual routine: Many tax-aware investors review their gain harvesting opportunity every November or December as part of year-end tax planning. Running this calculator with estimated year-end income gives you a clear target for how much to harvest.
Caution: The sale must settle before December 31 to count for the current tax year. Stock trades settle in one business day (T+1), so selling by December 29 or 30 (depending on the calendar) ensures timely settlement.
No. Tax gain harvesting only works in taxable brokerage accounts. Transactions inside retirement accounts (traditional IRA, Roth IRA, 401(k), 403(b)) have no immediate tax consequences, so there is nothing to "harvest."
Why it does not apply to retirement accounts:
- Traditional IRA/401(k) — All withdrawals are taxed as ordinary income regardless of whether the underlying investments had gains or losses. There is no concept of capital gains rates inside these accounts.
- Roth IRA/Roth 401(k) — Qualified withdrawals are completely tax-free. Since you will never owe capital gains tax on growth inside a Roth, there is no benefit to "harvesting" the gains.
Where it does work:
- Individual or joint taxable brokerage accounts
- Trust accounts (depending on trust tax rules)
- Custodial accounts (UTMA/UGMA), though the kiddie tax may apply for minors
Strategic interplay: While you cannot harvest gains inside retirement accounts, your retirement account distributions do affect your taxable income. If you are doing Roth conversions or taking traditional IRA distributions in the same year, those add to your ordinary income and reduce the room available in the 0% LTCG bracket. Plan these strategies together to maximize the total benefit.
Tax gain harvesting, Roth conversions, and income timing are all strategies that compete for the same low-income bracket space. Understanding how they interact is critical for optimizing your tax plan.
Roth conversions vs. gain harvesting:
- Roth conversions add to your ordinary taxable income. Each dollar of Roth conversion raises your ordinary income, reducing the room left in the 0% LTCG bracket.
- Tax gain harvesting uses the room above your ordinary income (after deductions) up to the 0% LTCG ceiling. The more ordinary income you have, the less room for gain harvesting.
- Optimal ordering: Some financial planners recommend filling the 10% and 12% ordinary income brackets with Roth conversions first, then using the remaining room in the 0% LTCG bracket for gain harvesting. The exact split depends on your specific marginal rates and future projections.
ACA premium tax credits: If you are buying health insurance through the ACA marketplace, realized capital gains count toward your MAGI, which affects your premium subsidies. Harvesting too many gains could push your MAGI above a cliff that eliminates premium subsidies — potentially costing more than the tax savings. Always check ACA implications before harvesting.
Social Security taxation: For retirees, realized capital gains count toward the provisional income formula that determines how much of your Social Security benefits are taxable. Harvesting gains could push up to 85% of your benefits into taxable territory.
Bottom line: Tax gain harvesting does not exist in a vacuum. Model the full picture — including Roth conversions, ACA subsidies, Social Security taxation, and state taxes — before deciding how much to harvest.
Harvested gains at 0% tax? Now find your next investment with a professional DCF model.