Capital Gains

Tax StrategyDifficulty: ███░░

Short-term (ordinary income rates) vs long-term (0%, 15%, 20%). The 0% bracket for low-income years. Qualified dividends. Net investment income tax.

Interactive Visualization

t=0s

Selling a stock after 11 months instead of 13 months can cost a saver thousands of dollars in tax. That timing mistake often erases years of compound growth when gains are large.

TL;DR: Capital gains are the taxable profit from selling an asset; knowing when gains are taxed as short-term versus long-term, how the 0% long-term bracket works, how qualified dividends fit in, and when the 3.8% net investment income tax applies can save or cost tens of thousands of dollars.

The Problem - what goes wrong when capital gains are misunderstood

Many investors meet a predictable failure. They trade without counting time windows, marginal tax brackets, or extra surcharges. A routine example shows the scale: sell 50,000ofstockafter11monthswhileearning50,000 of stock after 11 months while earning 120,000 salary, and that 50,000istaxedatordinaryrates.Useamarginalrateof2450,000 is taxed at ordinary rates. Use a marginal rate of 24% and the tax bill is 12,000. Hold one more month so the gain is long-term taxed at 15% and the bill falls to 7,500.Thedifferenceis7,500. The difference is 4,500 on a single trade. Small mistakes repeat across years. That 4,500couldcompoundat64,500 could compound at 6% to about 11,000 in 10 years. That is real money eaten by timing errors.

What else goes wrong. People mix up tax types and miss the 0% long-term bracket that can eliminate tax on gains in low-income years. For example, if taxable income is low enough for the 0% long-term capital gains bracket - often under roughly 44,600singleor44,600 single or 89,250 married filing jointly in a 2023 example - then a 20,000longtermgaincanincur20,000 long-term gain can incur 0 federal tax. Missing that window can cost 3,000ata153,000 at a 15% rate. Investors also forget the 3.8% net investment income tax - NIIT - which adds extra tax when modified adjusted gross income, or MAGI, exceeds 200,000 single or 250,000marriedfilingjointly.That3.8250,000 married filing jointly. That 3.8% applied to a 100,000 investment gain adds $3,800 to tax.

People also misclassify dividends. A 10,000dividendlabeledbyafirmasregularmaybeordinaryandtaxedattheinvestorsmarginalrate,oritmaybeaqualifieddividendandtaxedatlongtermcapitalgainsratesof010,000 dividend labeled by a firm as regular may be ordinary and taxed at the investor's marginal rate, or it may be a **qualified dividend** and taxed at long-term capital gains rates of 0%, 15%, or 20% depending on taxable income. Misreading qualified status can change a 10,000 payout tax from 2,400ata242,400 at a 24% ordinary rate to 1,500 at 15%, saving $900 instantly.

IF an investor ignores holding-period rules AND ignores taxable-income thresholds, THEN decisions about trade timing may increase lifetime taxes by thousands BECAUSE ordinary rates can be roughly 10 to 37% while long-term capital gains rates are 0% to 20%, with additional 3.8% NIIT in some cases. The following sections translate those facts into formulas and a clear decision framework.

How it actually works - mechanics, formulas, and real numbers

Start with the basic math. Capital gain equals sale proceeds minus cost basis minus selling costs. In formula form: Gain=Sales PriceCost BasisSelling Costs\text{Gain} = \text{Sales Price} - \text{Cost Basis} - \text{Selling Costs}. Holding period matters. If held for 12 months or less, it is a short-term capital gain taxed at ordinary marginal rates that range from 10% to 37% in current US brackets. If held for more than 12 months, it is a long-term capital gain taxed at 0%, 15%, or 20% depending on taxable income. For example, in a 2023 example the single-filer thresholds are 0% up to about 44,625,1544,625, 15% from about 44,626 to 492,300,and20492,300, and 20% above 492,300. Married filing jointly roughly doubles those thresholds to 0% up to about 89,250and1589,250 and 15% up to about 553,850.

Qualified dividends follow the same 0/15/20 schedule if they meet holding-period and issuer rules. If dividends are non-qualified, they are taxed as ordinary income. Use this formula for after-tax proceeds on a sale: After-tax=Gain×(1t)+Basis\text{After-tax} = \text{Gain} \times (1 - t) + \text{Basis} where tt is the applicable tax rate on the gain. Example with numbers: Gain=\text{Gain} = 50,000, tST=24%t_{ST}=24\%, tLT=15%t_{LT}=15\%. After-tax, short-term addition is 50,000×(10.24)=50,000 \times (1-0.24) = 38,000; long-term addition is 50,000×(10.15)=50,000 \times (1-0.15) = 42,500. Net difference is $4,500.

Add the NIIT where relevant. NIIT is 3.8% on the smaller of net investment income or MAGI above the threshold. Example: MAGI = 260,000marriedfilingjointly,threshold=260,000 married filing jointly, threshold = 250,000, excess = 10,000.Netinvestmentincomeincludesthegainof10,000. Net investment income includes the gain of 50,000, so NIIT applies to 10,000at3.810,000 at 3.8% = 380. NIIT is effectively added on top of the 0/15/20 rate, so combine taxes: tcombined=tcg+0.038t_{combined} = t_{cg} + 0.038 on the NIIT portion, capped by the lesser rule.

Remember state taxes. State capital gains tax rates vary from 0% to about 13.3% in California. If a state tax of 5% applies to a 50,000gain,add50,000 gain, add 2,500 to the federal tax bill in economic cost. Also note special categories: collectibles can be taxed at up to 28% and depreciation recapture at up to 25%. These are exceptions to the 0/15/20 rule.

IF an investor expects ordinary income rates above 24% AND the holding period can be extended beyond 12 months, THEN waiting may lower the tax rate by roughly 9 percentage points to 15% BECAUSE long-term rates are lower for most middle-to-upper incomes. Compute savings using the formulas above to see precise dollar impacts.

The decision framework - IF/THEN/BECAUSE rules to apply

Problem-first rule. Mistiming sales and ignoring thresholds creates repeated tax leakage. Use simple conditional rules that combine tax math, liquidity needs, and market risk. Each rule below includes clear numbers and trade-offs.

Rule 1 - Hold for long-term when leverage to timing is low. IF the expected short-term price movement is small relative to tax drag AND the holding period will exceed 12 months, THEN consider waiting because converting a short-term tax at 24% to a long-term tax at 15% saves 9 percentage points on the gain. Example trade-off: for a 50,000gain,thatsaves50,000 gain, that saves 4,500 now, which could compound at 5-7% into roughly 11,500to11,500 to 13,800 over 20 years.

Rule 2 - Use the 0% long-term bracket in low-income years. IF taxable income in a given year is low enough to fall below the 0% long-term threshold - for example roughly under 44,625singleor44,625 single or 89,250 married filing jointly in a 2023 example - THEN realize long-term gains up to those thresholds because federal tax on those gains may be $0, producing immediate tax savings equal to the avoided 15% rate. The trade-off is possibly increasing income in future years when rates or thresholds might change.

Rule 3 - Consider NIIT and MAGI. IF MAGI exceeds 200,000singleor200,000 single or 250,000 married filing jointly by more than $5,000 and investment income is significant, THEN expect an extra 3.8% on part or all of gains because NIIT applies to the lesser of net investment income and excess MAGI. The trade-off is that tax avoidance strategies that push MAGI below the thresholds may require deferring income or accelerating deductions, which can change retirement account opportunities.

Rule 4 - Use tax-advantaged accounts for frequent trading. IF short-term active trading is expected and after-tax performance matters, THEN trade inside tax-advantaged accounts like a 401(k) or Roth IRA because trades inside avoid immediate capital gains taxation; the trade-off is contribution limits of 22,500to22,500 to 30,000 depending on age and year, and possible taxes on withdrawal for pre-tax accounts.

Rule 5 - Harvest losses to offset gains. IF realized losses exist or can be created and not constrained by the wash sale rule, THEN use losses to offset realized gains because each $1,000 of losses offsets taxable gains at the marginal rate or at capital gains rate if offsetting long-term gains. The trade-off is maintaining desired asset allocation and incurring transaction costs.

Each decision requires plugging real numbers into After-tax=Gain×(1teffective)\text{After-tax} = \text{Gain} \times (1 - t_{effective}) and comparing net proceeds. IF the difference exceeds other costs like opportunity cost or trading fees, THEN execute the lower-tax strategy because dollars saved compound and increase future wealth.

Edge cases and limitations - where this framework breaks down

This framework does not cover every special tax rule. It also has behavioral and market risks. List of key limitations and scenarios with numbers.

Limitation 1 - State taxes vary widely. Federal long-term rates may be 0% to 20%, but combined state taxes can add 0% to about 13.3% in a high-tax state like California. IF an investor lives in California and has a 100,000gaintaxedfederallyat15100,000 gain taxed federally at 15% (15,000) plus state at 13.3% (13,300),THENthecombinedtaxis13,300), THEN the combined tax is 28,300 or 28.3% because state rules apply on top of federal ones. The trade-off is different decisions in low-tax states.

Limitation 2 - Special categories change rates. Collectibles and certain small business dispositions face up to 28% or special recapture at up to 25%. IF selling collectibles worth 50,000,THENexpectupto50,000, THEN expect up to 14,000 in tax at 28% because those assets fall under a different rate schedule. The framework above assuming 0/15/20 will understate tax significantly.

Limitation 3 - Wash sale and basis complexities. The wash sale rule disallows recognizing losses if substantially identical securities are bought within 30 days, which can stop immediate tax-loss harvesting. IF an investor tries to capture a 5,000lossthenrepurchasesthesameETFwithin30days,THENthat5,000 loss then repurchases the same ETF within 30 days, THEN that 5,000 loss is disallowed and added to the new basis because of the wash sale rule. This changes the timing of tax benefits and must be tracked precisely.

Limitation 4 - Market timing risk and liquidity. Waiting more than 12 months to save, say, 9 percentage points on tax may expose the investor to a price decline of 10% or more. IF the position drops by 10% while waiting, THEN the tax saved on the original gain may be erased because the pre-tax loss reversed the gain. Behaviorally, some investors sell to rebalance or meet cash needs, which this tax-centered framework cannot justify by itself.

Limitation 5 - Law change risk. Thresholds and rates change; the 0/15/20 schedule and NIIT are subject to legislative change. IF Congress changes rates or thresholds next year, THEN past calculations may be invalid because tax parameters are not guaranteed. This framework should be used with current-year thresholds and reviewed annually.

These limitations mean the framework often needs adjustments for state tax rates, asset type, wash sale rules, liquidity needs, and the risk of future tax law changes. IF those conditions exist, THEN compute scenario-specific after-tax outcomes and compare them to the base-case trades.

Worked Examples (3)

Short-term versus long-term on a $50,000 gain

Single filer with 120,000salaryin2023.Sell120,000 salary in 2023. Sell 50,000 of appreciated stock after 11 months or after 13 months. Marginal ordinary rate assumed 24%. Long-term capital gains rate assumed 15%. No NIIT or state tax.

  1. Calculate short-term tax: 50,000gaintaxedatordinaryrate2450,000 gain taxed at ordinary rate 24%: 50,000 \times 0.24 = $12,000.

  2. After-tax proceeds short-term: 50,00050,000 - 12,000 = $38,000 added to basis return.

  3. Calculate long-term tax: 50,000gaintaxedatlongtermrate1550,000 gain taxed at long-term rate 15%: 50,000 \times 0.15 = $7,500.

  4. After-tax proceeds long-term: 50,00050,000 - 7,500 = $42,500.

  5. Net difference: 42,50042,500 - 38,000 = $4,500 saved by waiting one more month.

Insight: Waiting from 11 to 13 months on a 50,000gainsaved50,000 gain saved 4,500 in federal tax under these assumptions; that 4,500couldgrowtoroughly4,500 could grow to roughly 11,800 at 6% over 15 years, showing the compounded value of tax timing.

Using a low-income year to realize gains tax-free

A married couple filing jointly expects taxable income of 80,000inaretirementyear.Theyhold80,000 in a retirement year. They hold 30,000 of long-term appreciated stock and consider selling in that calendar year. Use 2023 long-term thresholds with 0% up to $89,250 for married filing jointly.

  1. Determine taxable income before gains: 80,000,whichisbelowthe080,000, which is below the 0% threshold of 89,250 for married filing jointly in this 2023 example.

  2. Allowed long-term gain at 0% equals the remaining threshold: 89,25089,250 - 80,000 = $9,250 of gains may be taxed at 0%.

  3. If they realize 30,000ofgains,30,000 of gains, 9,250 is taxed at 0% and the remaining 20,750istaxedat1520,750 is taxed at 15%: 20,750 \times 0.15 = $3,112.50.

  4. Total federal tax on the 30,000gainwouldbe30,000 gain would be 3,112.50 under these assumptions.

Insight: Filing in a low-income year allows up to 9,250oflongtermgainstobetaxfreeforthiscoupleinthisexample;strategicrealizationcanconvertwhatwouldbe9,250 of long-term gains to be tax-free for this couple in this example; strategic realization can convert what would be 4,500 in tax under normal circumstances into 3,112.50,savingabout3,112.50, saving about 1,387.50 immediately.

NIIT bite on high MAGI

Single filer has MAGI of 230,000andrealizes230,000 and realizes 100,000 long-term capital gains. NIIT threshold is $200,000 single; NIIT rate is 3.8%. Long-term federal rate on gains assumed 15%.

  1. Excess MAGI over threshold: 230,000230,000 - 200,000 = $30,000.

  2. NIIT applies to the smaller of net investment income (100,000)andexcessMAGI(100,000) and excess MAGI (30,000). So NIIT base = $30,000.

  3. NIIT amount = 30,000×0.038=30,000 \times 0.038 = 1,140.

  4. Long-term capital gains tax = 100,000×0.15=100,000 \times 0.15 = 15,000. Combined federal tax = 15,000+15,000 + 1,140 = $16,140.

Insight: The 3.8% NIIT increased federal tax on the 100,000gainby100,000 gain by 1,140, raising the effective tax rate from 15% to about 16.14% for this taxpayer. Small percentage points can cost thousands on large gains.

Key Takeaways

  • Capital gains equal sale price minus cost basis minus selling costs: $\text{Gain} = \text{Sales Price} - \text{Cost Basis} - \text{Selling Costs}.

  • Holding period drives rate: short-term is <=12 months taxed at ordinary rates (10% to 37%), long-term is >12 months taxed at 0%, 15%, or 20%.

  • The 0% long-term bracket can eliminate federal tax on gains for taxable income below thresholds; example 2023 single roughly 44,625andmarriedfilingjointlyroughly44,625 and married filing jointly roughly 89,250.

  • NIIT adds 3.8% on the lesser of net investment income or MAGI above 200,000single/200,000 single / 250,000 married filing jointly and should be included in combined tax math.

  • Qualified dividends receive long-term capital gains rates if holding and issuer rules are met; non-qualified dividends are taxed as ordinary income.

  • State taxes, collectibles (up to 28%), and depreciation recapture (up to 25%) can change effective tax rates materially and must be calculated separately.

Common Mistakes

  • Treating long-term status as automatic: many investors assume any multi-year position is long-term. This is wrong because the rule is strictly more than 12 months; selling at 365 days versus 366 days changes tax treatment.

  • Ignoring the NIIT: investors may calculate only 0/15/20 federal rates. That is wrong when MAGI exceeds 200,000singleor200,000 single or 250,000 married filing jointly because a 3.8% surtax can apply and add thousands on large gains.

  • Forgetting state tax: computing only federal tax assumes state tax is zero. That is wrong in high-tax states where state rates of 5% to 13.3% can double the total tax cost on gains.

  • Misclassifying dividends: assuming all dividends are qualified is wrong; a 10,000dividendtaxedat2410,000 dividend taxed at 24% ordinary rather than 15% long-term loses 900 immediately if misclassified.

Practice

easy

Easy: Single filer with 60,000taxableincomein2023sells60,000 taxable income in 2023 sells 20,000 of stock held 14 months. Use 2023 thresholds with 0% up to $44,625 single. Calculate federal tax on the gain assuming long-term rate of 15% for income above 0% bracket.

Hint: Determine how much of the 0% bracket remains then tax the rest at 15%.

Show solution

Taxable income before gain = 60,000.060,000. 0% bracket ends at 44,625 so none of the 20,000gainfitsinto020,000 gain fits into 0% because 60,000 is already above the threshold. Entire 20,000taxedat1520,000 taxed at 15%: 20,000 \times 0.15 = $3,000.

medium

Medium: Married filing jointly with 90,000taxableincomeconsidersrealizing90,000 taxable income considers realizing 40,000 long-term gains in 2023. 0% bracket for married filing jointly is about 89,250.Calculatefederaltaxonthegainsandshowthetaxdifferenceversusrealizing89,250. Calculate federal tax on the gains and show the tax difference versus realizing 40,000 as short-term taxable at a marginal ordinary rate of 22%. Ignore NIIT and state taxes.

Hint: Compute available 0% space then split the gain between 0% and 15% portions, and compare to 22% ordinary taxation.

Show solution

Taxable income before gains = 90,000.090,000. 0% threshold = 89,250 so remaining 0% capacity = 89,25089,250 - 90,000 = -750,sononeremains.Entire750, so none remains. Entire 40,000 taxed at 15%: 40,000×0.15=40,000 \times 0.15 = 6,000. If taxed short-term at 22%: 40,000×0.22=40,000 \times 0.22 = 8,800. Difference = 8,8008,800 - 6,000 = $2,800 saved by long-term treatment.

hard

Hard: Single filer MAGI 210,000realizes210,000 realizes 150,000 long-term gains in 2023. Compute federal tax using 15% long-term rate, include NIIT 3.8% where applicable, and compute combined federal tax rate on the gain. Then compute after-tax proceeds. Assume 0/15/20 thresholds place these gains at 15% before considering NIIT.

Hint: Find excess MAGI over $200,000, apply NIIT to the lesser of excess and net investment income, then add long-term tax on entire gain.

Show solution

Excess MAGI = 210,000210,000 - 200,000 = 10,000.NIITbase=lesserofexcess(10,000. NIIT base = lesser of excess (10,000) and net investment income (150,000)soNIITappliesto150,000) so NIIT applies to 10,000. NIIT amount = 10,000×0.038=10,000 \times 0.038 = 380. Long-term tax = 150,000×0.15=150,000 \times 0.15 = 22,500. Combined federal tax = 22,500+22,500 + 380 = 22,880.Combinedeffectiverateonthe22,880. Combined effective rate on the 150,000 gain = 22,880/22,880 / 150,000 = 15.2533% approx. After-tax proceeds = 150,000150,000 - 22,880 = $127,120.

Connections

This lesson builds on Asset Classes (/money/asset-classes) because risk, expected returns, and liquidity determine whether delaying a sale makes sense. It also builds on Tax Brackets (/money/tax-brackets) since marginal and taxable income calculations determine capital gains rates. Understanding capital gains unlocks Tax-efficient Investing (/money/tax-efficient-investing) such as location of assets across taxable versus tax-advantaged accounts, and Retirement Withdrawal Strategies (/money/withdrawal-strategies) where sequencing withdrawals of taxable gains, qualified dividends, and pre-tax account distributions affects lifetime tax cost.