Tax-Loss Harvesting Calculator Formula
Understand the math behind the tax-loss harvesting calculator. Each variable explained with a worked example.
Formulas Used
Total Tax Savings
tax_savings = min(capital_losses, capital_gains) * tax_rate / 100 + income_offset * income_tax_rate / 100Net Taxable Gain
net_taxable_gain = net_gainLoss Carryforward
carryforward = max(excess_loss - 3000, 0)Variables
| Variable | Description | Default |
|---|---|---|
capital_gains | Realized Capital Gains(USD) | 10000 |
capital_losses | Available Capital Losses(USD) | 7000 |
tax_rate | Capital Gains Tax Rate(%) | 15 |
income_tax_rate | Ordinary Income Tax Rate(%) | 22 |
net_gain | Derived value= max(capital_gains - capital_losses, 0) | calculated |
excess_loss | Derived value= max(capital_losses - capital_gains, 0) | calculated |
income_offset | Derived value= min(excess_loss, 3000) | calculated |
How It Works
Tax-Loss Harvesting
1. Losses offset gains dollar-for-dollar 2. Excess losses offset up to $3,000 of ordinary income 3. Remaining losses carry forward to future years
Tax Savings = Offset Gains x CG Rate + Income Offset x Income Rate
Be aware of the wash sale rule: you cannot repurchase the same or substantially identical security within 30 days.
Worked Example
$10,000 gains, $7,000 losses, 15% CG rate.
capital_gains = 10000capital_losses = 7000tax_rate = 15income_tax_rate = 22
- 01$7,000 losses offset $7,000 of gains
- 02Net taxable gain = $3,000
- 03Tax savings = $7,000 x 15% = $1,050
- 04No excess losses for income offset
Ready to run the numbers?
Open Tax-Loss Harvesting Calculator