How to offset capital gains with capital losses
When you sell an investment at a loss, that loss can directly reduce the tax you owe on profitable sales. It is one of the most useful tools you have as a US investor, and it is entirely within your control.
The IRS has a specific netting process that determines how short-term and long-term gains and losses interact. It matters, because the order affects your final tax bill.
Losses offset gains dollar for dollar
A $5,000 loss offsets $5,000 of gains, reducing your taxable gain by the full amount. Since capital gains can be taxed at rates up to 37% for short-term gains, every dollar you offset is a dollar you do not pay tax on.
But the IRS does not let you simply subtract total losses from total gains. There is a specific netting order.
The netting process
Step 1: net short-term gains and losses
Add up all your short-term gains and losses for the year. The result is either a net short-term gain or a net short-term loss. Offsetting short-term gains provides the greatest benefit because they are taxed at ordinary income rates (10% to 37%).
Step 2: net long-term gains and losses
Do the same with long-term gains and losses. Long-term gains are taxed at 0%, 15%, or 20%, so the per-dollar savings from offsetting them are lower, but still valuable.
Step 3: cross-offset
If one category has a net gain and the other a net loss, they offset each other. A net long-term loss wiping out a net short-term gain is especially beneficial: you are eliminating a gain that would have been taxed at the higher ordinary income rate. The reverse (short-term loss offsetting long-term gain) is less efficient but still reduces your total bill.
Worked example
Suppose for the 2025 tax year (filed by April 15, 2026) you have:
- Short-term gain: $8,000 (Stock A, held 6 months)
- Short-term loss: $3,000 (Stock B, held 4 months)
- Long-term gain: $5,000 (Stock C, held 2 years)
- Long-term loss: $7,000 (Stock D, held 18 months)
Step 1: Short-term: $8,000 - $3,000 = $5,000 net short-term gain
Step 2: Long-term: $5,000 - $7,000 = ($2,000) net long-term loss
Step 3: Cross-offset: $5,000 - $2,000 = $3,000 net short-term gain
If you are a single filer with $90,000 salary, that $3,000 is taxed at 22% = $660.
Without the losses, you would have owed $1,760 on the short-term gains plus $750 on the long-term gains ($2,510 total). The $10,000 in total losses saved you $1,850.
The $3,000 deduction rule
When total losses exceed total gains for the year, the IRS lets you deduct up to $3,000 of net capital losses against ordinary income ($1,500 if married filing separately). This means investment losses can reduce tax on your salary, not just your investment gains.
Example: You have $2,000 in gains and $9,000 in losses. The first $2,000 offsets your gains. Of the remaining $7,000, you deduct $3,000 against ordinary income this year. In the 24% bracket, that saves $720. The leftover $4,000 carries forward.
If you had no gains at all and $10,000 in losses, it takes about four years to fully use them through the $3,000 annual deduction (assuming no future gains to offset). But if you realize gains in any of those years, carried-forward losses offset them dollar for dollar first.
Loss carryforward rules
Excess losses carry forward indefinitely. There is no expiration. A large loss from a bad year is never wasted.
Your carryforward is tracked on Schedule D, and the Capital Loss Carryover Worksheet in the Schedule D instructions calculates the amount. Tax software handles this automatically if you use the same software each year, but if you switch, you need to carry the number over yourself.
One detail worth knowing: carried-forward losses keep their character. Long-term losses remain long-term and first offset long-term gains before crossing over to short-term. Short-term losses are generally more valuable because they first offset gains taxed at higher rates.
Tax-loss harvesting
Tax-loss harvesting is the practice of deliberately selling investments that have declined to realize losses. You then use those losses to offset gains elsewhere in your portfolio.
The approach: review your portfolio for unrealized losses, sell those holdings, use the losses to offset realized gains for the same calendar year, and optionally reinvest in a similar (but not substantially identical) security to stay in the market.
Harvesting is most valuable when you have significant short-term gains. A $5,000 short-term loss offsetting a $5,000 short-term gain saves $1,200 at the 24% bracket. The same loss offsetting a long-term gain saves only $750 at 15%.
For a complete guide, see tax-loss harvesting for US investors.
Wash sale interaction
The wash sale rule is the biggest constraint. If you sell at a loss and buy the same (or "substantially identical") security within 30 days before or after the sale, the IRS disallows the loss. The window is 61 days total (30 before, the sale day, 30 after).
The loss is not gone forever. It gets added to the cost basis of the replacement shares, deferring the benefit until you eventually sell those shares.
Example: You sell 100 shares of XYZ at $35 (bought at $50) to realize a $1,500 loss. Three weeks later, you buy 100 shares back at $30. The loss is disallowed. Your new cost basis becomes $45 per share ($30 purchase + $15 disallowed loss). You will benefit eventually, but you lost the immediate offset.
To avoid wash sales while staying invested: wait 31 days before rebuying, or buy a different security in the same sector or asset class.
For more on wash sale rules and harvesting strategies, see our tax-loss harvesting guide.
Timing considerations
Gains and losses are calculated on a calendar-year basis, which creates some important deadlines for the 2025 tax year.
End-of-year review: By November or December, you know most of your realized gains and can estimate your liability. This is the time to look for unrealized losses worth harvesting.
December 31 deadline: Losses must be realized (trade executed, not just settled) by the last trading day. Do not wait until the final day. Aim for mid-December.
January considerations: If you realize a loss in late December and want to rebuy the same security, you must wait until late January to avoid a wash sale. You will be out of the position for about a month. Alternatively, buy a similar but not identical security immediately.
Multi-year planning: Because losses carry forward indefinitely, plan beyond a single year. If you expect large gains next year, start harvesting losses this year. If you are in a low-income year where gains would be taxed at 0% or 10%-12%, save your losses for a higher-income year.
How TrackMyShares helps
The tax-loss harvesting tool scans your portfolio for holdings with unrealized losses, shows whether selling would offset short-term or long-term gains, estimates tax savings, and recommends an action. Wash sale detection alerts you when a sale-and-repurchase pattern could trigger the rule.
The US capital gains tax report shows your realized gains and losses broken down by holding period, so you can see the netting result at any time, not just at tax time. Every purchase is tracked as a separate lot with its own cost basis, date, and holding period. Prices are updated throughout the day so you can spot harvesting opportunities as they arise.
Sign up for TrackMyShares to track gains and losses, find harvesting opportunities, and see your net position for the 2025 tax year before the April 2026 filing deadline.
This is general information, not personal tax or financial advice.