Skip to content

How it’s calculated2026 figures

Capital gains, dividends and investment taxes

Preferential rates, gain stacking, loss carryforwards and the NIIT.

Updated

Where this happens in a plan year

2of 8 stages

  1. Events
  2. Growth (covered)
  3. Required
  4. Income
  5. Spending
  6. Cash flow
  7. Taxes (covered)
  8. Year end
On this page
  1. Where gains and dividends come from
  2. How gains stack on ordinary income
  3. Losses and the carryforward
  4. Net investment income tax
  5. Harvesting gains to fill a bracket
  6. What isn’t modeled

CoastMath taxes realized gains and dividends from taxable accounts at the long-term capital gains rates of 0, 15 and 20 percent. They are stacked on top of your ordinary taxable income. Every realized gain is treated as long-term and every dividend as qualified, unless a brokerage account sets a lower qualified share; the rest is ordinary income. Gains use average cost basis. Realized losses offset gains, then up to $3,000 of ordinary income a year, and the rest carries forward. Above a fixed income threshold, the 3.8% net investment income tax applies as well.

Sales. A gain is realized whenever money leaves a taxable brokerage or crypto account: a withdrawal to cover a shortfall, a gift funded from the account, or a transfer out. Each sale carries the account’s average gain.

Realized gain=Amount sold×(1 − Cost basis ÷ Balance)

Basis falls in proportion to the share sold. A sale when the balance is below basis realizes a loss. Contributions and reinvested dividends add to basis dollar for dollar. A blank cost basis is treated as equal to the opening balance, so the existing holding carries no gain until it grows (see Opening balances and cost basis).

Dividends. Each year the stock share of a taxable brokerage balance pays the dividend yield. The dividend is taxed as a qualified dividend and reinvested, which adds to basis, unless the account pays its income out to cash (see How balances grow each year). Crypto pays no dividend. Bond returns are treated as price growth, so bonds generate no separate interest income, and checking and savings balances earn none.

Property sales. The taxable gain on a home or other property, after any home-sale exclusion, joins the year’s long-term gains (see Selling a home or property).

Retirement accounts and HSAs never produce capital gains; their withdrawals are ordinary income or tax-free.

2026 long-term capital gains rates (taxable income up to)
Filing status0% up to15% up to
Single$49,450$545,500
Married filing jointly$98,900$613,700
Married filing separately$49,450$306,850
Head of household$66,200$579,600

Gains above the 15% limit are taxed at 20%. Later years grow these thresholds with your plan’s inflation assumption.

The thresholds apply to total taxable income, with ordinary income counted first. Gains fill whatever 0% room ordinary income leaves, then the 15% band. When deductions exceed ordinary income, the unused deduction reduces the gains before any rate applies.

Example: single filer, $40,000 of ordinary taxable income and a $30,000 long-term gain in 2026
0%15%$0$100K

The gray bar is ordinary income, taxed at ordinary rates. Only the gain is taxed at these rates.

Show data
Example: single filer, $40,000 of ordinary taxable income and a $30,000 long-term gain in 2026
LayerFromToRate
Ordinary taxable income$0$40,000Ordinary brackets
Gain in the 0% band$40,000$49,4500%
Gain in the 15% band$49,450$70,00015%
Example, continued
Gain in the 0% band$49,450 − $40,000$9,450
Gain in the 15% band$20,550
×Rate15%
=Capital gains tax$3,082.50

The marginal rate in results is the ordinary bracket only. A year with gains in the 15% band can show a 12% marginal rate.

Each year CoastMath nets realized gains against realized losses and any loss carried in. A net loss reduces ordinary income by up to $3,000 ($1,500 married filing separately), and the remainder carries to the next year without expiring. Losses never offset qualified dividends. When taxable income is too small to absorb the full $3,000, the unused part stays in the carryforward. Losses on a primary residence or personal-use property are not deductible.

Example: single, $80,000 of wages, a $20,000 carryforward, $5,000 of realized gains and $2,000 of dividends in 2026
Realized gains$5,000
−Loss carried in$20,000
=Net capital loss−$15,000
→Deducted from ordinary income$3,000
→Carried to 2027$12,000
Qualified dividends, still taxed$2,000
×15% rate15%
=Capital gains tax$300

The remaining carryforward for each year appears as Capital loss carryforward in the OverviewIncome & taxes tooltip.

Net investment income tax
Rate
3.8%
Single or head of household
$200,000
Modified AGI threshold
Married filing jointly
$250,000
Married filing separately
$125,000

The tax is 3.8% of the smaller of net investment income or modified AGI above the threshold. The thresholds are fixed in the law and don’t grow with inflation, so more years cross them as nominal income rises.

Investment income counts realized gains (including a taxable home-sale gain), dividends, taxable bond interest (not municipal interest), and income streams whose Income tax treatment is Investment income or Nonqualified annuity taxable income. Wages, self-employment income, Social Security, retirement-account withdrawals, Roth conversions, and streams marked Qualified pension or retirement distribution or Other ordinary income excluded from NIIT are not investment income. They still raise modified AGI, though, so a conversion can expose gains to the tax.

Example: single, $180,000 of wages and a $50,000 long-term gain in 2026
Modified AGI$230,000
−Threshold$200,000
=ExcessSmaller than the $50,000 of investment income$30,000
×Rate3.8%
=Net investment income tax$1,140

A gain-harvesting rule sells and immediately rebuys appreciated holdings in one taxable brokerage account each year. The sale realizes gain up to the top of a capital gains band you choose, usually 0%. The balance doesn’t change; basis rises by the gain realized, which shrinks the taxable gain on later sales. There is no wash-sale limit on gains.

  1. Open Tax toolsStrategy comparisons and set Strategy to Capital-gain harvesting to fill a capital-gains bracket.
  2. Choose the Taxable account, when it runs (Convert from and Convert until), an optional MAGI cap in today’s dollars and the Capital-gains bracket ceilings to test.
  3. Select Compare strategies, then Apply the row you want to keep.

Room is measured from the year’s ordinary taxable income, including conversions and gains already realized, before the year’s shortfall withdrawals. The harvest counts its own effect on that income: the extra gain can make more Social Security taxable and shrink the senior deduction, so the rule realizes less. A withdrawal later in the same year can still push part of the harvested gain above the ceiling. A higher modified AGI from harvesting can also affect the net investment income tax, Social Security taxation, premium credits and Medicare surcharges. The comparison table reports lifetime taxes, health costs, net estate, and the years with Medicare surcharges or lost premium credits for each candidate.

You seeCheckThen
A withdrawal from brokerage produces much less gain than expected.
The account’s cost basis entry.
A blank basis counts the whole opening balance as basis; enter the actual basis.
Gains are taxed although income looks under the 0% limit.
Ordinary taxable income, including conversions and required distributions.
Gains start where ordinary taxable income ends, not at zero.
The carryforward shrinks although no gains were realized.
The year’s ordinary income.
Up to $3,000 a year is used against ordinary income automatically.
Next in TaxesPayroll taxes, self-employment tax and AMT