Calculator
Realized This Year (Gains & Losses)
Estimated Federal Tax on Gains
$4,659.5
Tax Analysis
Federal netting leaves you owing $4,659.5 on $27,000 of net gains — an effective 17.3%. Losses successfully offset $3,000 of gains. You keep $22,340.5 after tax, which is the number that belongs in your reinvestment plan.
*Estimated using 2024 federal IRS rates (10–37% ordinary brackets and 0/15/20% long-term rates). Does not include the 3.8% Net Investment Income Tax, state taxes, or the wash-sale rule limits. Educational only, not tax advice.
Every time you sell a holding in a taxable account, the IRS takes a position on the transaction — and the rules treat the result very differently depending on how long you held it. Gains on positions kept a year or less are taxed as ordinary income, at rates up to 37%; gains on holdings of a year or more enjoy preferential long-term rates of 0%, 15%, or 20%. Losses, meanwhile, first cancel gains of the same type, then cross-cancel, and any leftover loss can offset up to $3,000 of ordinary income each year, with the rest carried forward. For US investors this is not paperwork; it is portfolio math. Two identical $10,000 gains can cost $3,200 in tax or $1,500 depending purely on holding period. Two identical trades, one timed in December and one in January, can swing a tax year. Knowing your net exposure before you trade — not while filing in April — is what separates tax-aware investing from tax-surprised investing, and it is exactly what this calculator computes across an entire year of realized short-term and long-term activity.
The calculation follows the same netting sequence the IRS applies on Schedule D. Step one: within each bucket, net the gains and losses — short-term gains minus short-term losses, long-term gains minus long-term losses. Step two: cross offset. A net short-term loss is applied against a net long-term gain (and vice versa) until one side is exhausted. What survives is the net short-term figure and the net long-term figure that actually get taxed. Step three taxes each survivor at its own rates. Net short-term gains stack onto ordinary income and are taxed through the 10–37% marginal brackets. Net long-term gains sit on top of that total and are taxed at the 0/15/20% schedule — the famous 'stacking' rule, where your ordinary income decides which long-term band you pay. Step four handles losses: if everything nets negative, up to $3,000 deducts against ordinary income (saving you that amount times your marginal rate) and the balance carries forward indefinitely. Your after-tax profit is the net gain minus the tax, which is the true number available for reinvestment.
A position held 364 days pays ordinary rates; held 366 days it pays 0%, 15%, or at most 20%. For a high earner in the 32% bracket that single day is worth 12–20 points of tax on the gain. Before selling any winner inside that one-year window, ask whether waiting a few weeks is worth thousands — for planned rebalances, it almost always is.
Capital losses are only usable in the year they are realized, and the wash-sale rule blocks repurchase within 30 days. Harvesting losses in December nets them against that year's gains; waiting until January shifts the benefit into the next tax year, where the gains may be larger and your bracket higher. December tax reviews have saved more investor money than any market-timing strategy.
Because short-term gains are taxed at your marginal ordinary rate, a large one can push the rest of your income higher. If you control which lots to sell, harvest the low-basis long-term lots first, use losses to neutralize the short-term gains, and keep total realized gains under the 0% long-term threshold when income is low — a retired taxpayer between jobs can often realize long-term gains literally tax-free.
Enter the planned gain or loss into this calculator before executing the trade, using your estimated ordinary taxable income for the year. The tax figure it produces is part of the transaction price: a sale that returns 8% after 15% tax beats one that returns 9% after 32% tax. Treat the after-tax figure as the performance metric, not the gross.
Keep a running tally of realized short-term and long-term gains and losses as they happen — most brokerages provide a realized-gains report any time. Mid-year tracking lets you harvest losses opportunistically and avoid year-end surprises. December scramble-selling is usually the result of not knowing your running totals in July.
If you owe tax on gains this year, look across the portfolio for unrealized losses to realize before year-end. Even $3,000 of excess loss pays you back at your marginal rate — $1,100 at a 37% bracket. Then, if you still like the position, wait out the wash-sale window and rebuy. A planned harvest-and-rebuild converts dead losses into live tax savings.
Marcus wanted to trim a stock he had bought 10 months earlier, sitting on a $30,000 gain. At his $210,000 income, the short-term rate would have been 32% — about $9,600 in federal tax. This calculator showed him that holding six more weeks until the one-year mark switched the same gain to the 15% bucket: $4,500 of tax. He waited, paid himself back $5,100 minus the state-tax difference, and sold in February instead.
The Chens realized $18,000 in long-term gains midyear when they sold a house fund for a down payment. In December they reviewed positions and found $15,000 of unrealized losses in a lagging sector fund they no longer wanted. Harvesting them cut the taxable gain to $3,000 — a federal tax saving of about $2,250. They kept a watchlist of replacement candidates to avoid wash-sale traps and rebuilt the exposure in January.
After a rough year, Pat carried a $25,000 capital loss into the next tax year. Most of it sat unused because she had no gains — but each year it deducted $3,000 against her ordinary income, saving over $700 annually at her 24% rate. When she finally sold a rental with a big gain in year five, the remaining carryover wiped nearly all of it. The calculator made her see that a loss is a tax asset with a long shelf life, not just a bad memory.
Everything you need to know about this topic.

Financial Chaos Analyst
Ivy Sinclair-Wren is a Financial Chaos Analyst covering investing, AI, wealth psychology, and the emotional consequences of opening finance apps during market crashes. Based in Melbourne, she specializes in demystifying the US tax code and helping users navigate the intersection of spreadsheet logic and human irrationality.