AI
aiagent.org
/ Learn / Stock & Equity Tax
โš ๏ธ Educational Reference & Equity Tax Notice: Equity compensation rules (RSU, ESPP, ISO/NSO), capital gains tax laws, IRS Form 8949 adjustments, wash sale rules (IRC ยง1091), and tax-loss harvesting models presented here are for educational self-study and analytical simulation. They do not constitute formal CPA, tax accounting, or financial legal counsel. Always verify cost basis reporting with your 1099-B and Form 3921/3922 with a certified tax professional.
Tax Reference
๐Ÿ“Š Stock & Equity Compensation Tax Blueprint

Mastering Stock Taxes: RSUs, ESPP, Wash Sales & Loss Harvesting

A rigorous, practitioner guide for software engineers, tech professionals, and active investors. Decode RSU supplemental withholding traps, navigate qualifying vs. disqualifying ESPP dispositions, avoid the 1099-B double tax pitfall, master IRC ยง1091 wash sale rules, and execute systematic tax-loss harvesting.

๐Ÿ’Ž

1. Restricted Stock Units (RSU) Taxation

Vesting triggers, ordinary income recognition, withholding deficits, and the 1099-B double taxation trap.

W-2 Ordinary Income

The 3 Lifecycle Milestones of an RSU

1. Grant Date No Tax

Company promises to award shares in the future subject to a vesting schedule (e.g., 4-year vest with 1-year cliff).

2. Vesting Date TAX EVENT

Shares become unconditionally yours. Fair Market Value (FMV) ร— shares is immediately taxed as ordinary W-2 income.

3. Sale Date CAPITAL GAIN/LOSS

When you sell the shares. Gain or loss is calculated as Sale Price โˆ’ Vesting FMV (Cost Basis).

๐Ÿšจ The "Statutory 22% Supplemental Withholding" Trap

Under IRS federal rules, your employer is only required to withhold a flat 22% for federal income tax on supplemental compensation up to $1,000,000 (37% above $1M). However, many software engineers and professionals have a marginal tax bracket of 32%, 35%, or 37%!

Example: $100,000 RSU Vest in 35% Federal Bracket
โ€ข Employer Withholds at 22%: $22,000
โ€ข Actual Federal Tax Due at 35%: $35,000
โ€ข Withholding Deficit (Surprise Tax Bill in April): $13,000 + Underpayment Penalties!

How to fix: Ask payroll/brokerage to increase your supplemental withholding rate to your true marginal bracket (32%, 35%, or 37%), or submit quarterly estimated tax payments via IRS Form 1040-ES.

โš ๏ธ The 1099-B Double Taxation Pitfall (Form 8949 Code "B")

Brokers (Morgan Stanley, E*TRADE, Charles Schwab, Fidelity) are prohibited by IRS regulations from reporting compensation income on Form 1099-B Box 1e (Cost Basis) for non-covered shares or certain RSUs. As a result, your 1099-B often shows $0.00 or an unadjusted cost basis!

If you naively import your 1099-B into TurboTax or tax software without adjusting it, you will pay taxes twice on the exact same money: once as W-2 salary at vest, and again as a 100% capital gain upon sale!

The Solution: Use IRS Form 8949. Enter code "B" in Column (f) and enter the negative adjustment in Column (g) to correct the cost basis to the true vesting Fair Market Value.

How RSUs Are Handled at Vest

The 4 primary company execution methods:

1. Sell-to-Cover (Most Popular)

The broker automatically sells just enough shares on the open market at vest to pay mandatory withholding taxes, depositing the remaining net shares into your brokerage account.

2. Net Share Settlement

The company surrenders shares back to corporate treasury to pay taxes instead of selling into the open market, depositing only net shares.

3. Same-Day Sale (Auto-Sell All)

All shares are immediately liquidated at vest. Taxes are withheld, and cash is deposited. Zero capital gain/loss is realized.

4. Cash Transfer

You wire out-of-pocket cash to cover tax withholdings to keep 100% of your vested shares intact.

Mental Model: The Cash Test

"If your company handed you a cash bonus of $50,000 today after taxes, would you log into your brokerage and buy $50,000 of your employer's stock?"

If the answer is no, holding vested RSUs exposes you to excessive concentration risk (your paycheck and your portfolio depend on one firm). Selling immediately upon vest creates zero capital gain and allows instant diversification into index funds (e.g. VTI, VOO).

๐Ÿ›’

2. Employee Stock Purchase Plan (ESPP) Taxation

IRC ยง423 rules, 15% lookback discounts, qualifying vs. disqualifying dispositions, and Form 3922 tracking.

Section 423 Plan
The 15% Lookback Discount

Built-in Arbitrage

Many plans offer up to a 15% discount applied to the lesser of the stock price on the Offering Date or the Purchase Date.

IRS Statutory Cap

$25,000 / Calendar Year

IRC ยง423 caps your total purchases at $25,000 worth of stock per year, calculated using the undiscounted fair market value at the grant date.

Tax Reporting Form

IRS Form 3922

Your employer must issue Form 3922 for every purchase period, detailing Grant Date FMV, Purchase Date FMV, and actual purchase price.

Qualifying vs. Disqualifying Disposition Comparison

The tax treatment of your ESPP proceeds depends entirely on whether your sale meets the strict statutory two-prong holding period test.

Feature Qualifying Disposition (Held Long Enough) Disqualifying Disposition (Sold Early)
Holding Period Required > 2 years from Offering Date (Grant)
AND > 1 year from Purchase Date (Exercise)
Sold before meeting BOTH 2-year and 1-year holding criteria.
Ordinary Income Recognized Lesser of:
1. Actual gain (Sale Price โˆ’ Purchase Price), OR
2. 15% discount applied to Grant Date FMV.
If sold at a loss, Ordinary Income is $0!
Exact discount at purchase:
(Purchase Date FMV โˆ’ Purchase Price Paid) ร— shares.
Taxed as ordinary income even if the stock plummeted!
Capital Gain / Loss Always Long-Term Capital Gain (LTCG) for all remaining profits above the ordinary income cap. Can be Short-Term (if held ≤ 1 year from purchase) or Long-Term. Calculated as Sale Price โˆ’ Purchase Date FMV.
W-2 Inclusion Employer may not include in W-2 Box 1; you must self-report on Schedule 1. Usually automatically reported by employer in W-2 Box 1 as compensation.
Risk Profile Higher market risk (forced to hold company stock for 12โ€“24 months). Immediate risk-free discount lock-in if sold on day 1!
Case A: Stock Rises & You Hold (Qualifying)
  • โ€ข Grant FMV: $100 | Purchase FMV: $120
  • โ€ข 15% Lookback Price: $85 | Sold at: $150 (>2 yrs from grant)
  • โ€ข Total Profit: $150 โˆ’ $85 = $65
  • โ€ข Ordinary Income: Lesser of ($65 gain vs $15 discount) = $15
  • โ€ข Long-Term Capital Gain: $65 โˆ’ $15 = $50
Case B: Immediate Day 1 Sale (Disqualifying)
  • โ€ข Grant FMV: $100 | Purchase FMV: $120
  • โ€ข 15% Lookback Price: $85 | Sold on Day 1 at: $120
  • โ€ข Total Profit: $120 โˆ’ $85 = $35
  • โ€ข Ordinary Income (W-2): $120 โˆ’ $85 = $35
  • โ€ข Capital Gain/Loss: $120 โˆ’ $120 = $0.00
  • Result: Locked in 41.1% gain with zero downside market exposure!
โฑ๏ธ

3. Short-Term vs. Long-Term Capital Gains & Surtaxes

The 365-day holding clock, preferential federal tax rates, Net Investment Income Tax (NIIT 3.8%), and state disparities.

IRC ยง1222

Tax Rate Differences

Short-Term Capital Gains (≤ 365 Days) 10% โ€“ 37%

Taxed identically to regular salary and ordinary income. Subject to your highest marginal income tax bracket plus state income taxes.

Long-Term Capital Gains (> 365 Days) 0%, 15%, or 20%

Preferential federal rates. Single filers pay 0% up to ~$47,000, 15% up to ~$518,900, and 20% above that threshold.

Net Investment Income Tax (NIIT 3.8%) +3.8% Surtax

Enacted under IRC ยง1411. An extra 3.8% tax on net investment income (dividends, interest, capital gains) if Modified Adjusted Gross Income (MAGI) exceeds $200,000 (single) or $250,000 (married filing jointly).

IRS Schedule D Capital Gain Netting Order

When you file taxes, the IRS mandates a strict 3-step sequential algorithm to net your gains and losses:

Step 1: Net Short-Term Results
Total Short-Term Gains โˆ’ Total Short-Term Losses = Net Short-Term
Step 2: Net Long-Term Results
Total Long-Term Gains โˆ’ Total Long-Term Losses = Net Long-Term
Step 3: Cross-Net Short and Long
If one pool is positive and one is negative, cross-net them against each other. A short-term loss can erase a long-term gain, and a long-term loss can shield a high-tax short-term gain!
State Tax Geography: High-tax states like California (up to 13.3%) and New York (up to 10.9%) offer no preferential long-term capital gains ratesโ€”they tax all gains as ordinary income! Washington state levies a 7% excise tax on LTCG over $262,000.
๐Ÿšซ

4. The Wash Sale Rule (IRC ยง1091)

The 61-day window, basis adjustments, RSU/ESPP auto-triggers, and the permanent IRA loss forfeiture trap.

61-Day Penalty Window

What Triggers a Wash Sale?

Under IRS Section 1091, a wash sale occurs if you sell a security at a loss, and within a 61-day window (30 days before the sale, the day of the sale, and 30 days after the sale), you:

1. Rebuy Same Stock

Buy the same company stock or substantially identical securities.

2. Options & Contracts

Acquire a call option, in-the-money put, or contract to buy.

3. Auto RSU / ESPP

An automatic RSU vest or ESPP buy occurs within 30 days of selling at a loss.

The 61-Day IRS Window Anatomy
30 Days Before
Prior Rebuys Blocked
Day 0
Sale at a Loss
30 Days After
Post Rebuys Blocked

Note: A wash sale only applies to losses! If you sell at a profit and immediately buy back 5 seconds later, the IRS happily taxes your gain; there is no wash rule for winners.

What Happens to the Disallowed Loss in a Regular Taxable Account?

The loss is not permanently forfeited. Instead, two mechanics happen:

  1. Basis Adjustment: The disallowed dollar loss is added directly to the cost basis of the newly repurchased shares.
  2. Holding Period Tacking: The holding period of the original sold shares is added to the holding period of the replacement shares.
โ˜ ๏ธ The Fatal IRA Wash Sale Trap
IRS Revenue Ruling 2008-5

This is the single most expensive mistake investors make when attempting tax-loss harvesting:

If you sell shares at a loss in your regular taxable brokerage account, and purchase replacement shares inside your Traditional IRA or Roth IRA within the 61-day window:

1. The tax loss is disallowed on your tax return.
2. THE LOSS CANNOT BE ADDED TO YOUR IRA BASIS!

The tax deduction is permanently, completely vaporized into thin air. You can never reclaim it.

Safe TLH Substitution Pairs

To harvest a loss without triggering a wash sale while staying 100% invested in the market:

โŒ SPY ↔ VOO ↔ IVV (Too identical)
โœ… VOO (S&P 500) ↔ VTI (Total US Market)
โœ… SCHD (Dividend) ↔ VYM (High Div)
โœ… QQQ (Nasdaq 100) ↔ VGT (Info Tech)
๐ŸŒพ

5. Tax-Loss Harvesting & Loss Reclaim Concepts

Offsetting capital gains, the $3,000 W-2 income loss deduction, indefinite carryforward banks, and HIFO share selection.

$3k Annual W-2 Offset
๐Ÿ›ก๏ธ Unlimited

1. Unlimited Capital Gain Shield

Realized capital losses offset realized capital gains dollar-for-dollar without any ceiling. If you made $80,000 in short-term crypto/stock gains and harvested $80,000 in losses, your net taxable capital gain is $0.

๐Ÿ’ต $3,000 / Year Cap

2. Ordinary Income Loss Reclaim

If your total realized capital losses exceed all your capital gains, you can deduct up to $3,000 per year ($1,500 if married filing separately) directly against your ordinary W-2 salary, reducing your highest-bracket tax burden.

๐Ÿฆ No Expiration

3. Indefinite Loss Carryforward

Unused net losses roll forward to future tax years indefinitely until exhausted. A $50,000 loss can shield $10k gains today, offset $3k W-2 wages this year, and bank the remaining $37k to offset gains in 2027, 2028, and beyond.

โš™๏ธ Broker Cost Basis Method: Avoid the "FIFO Default" Trap

HIFO > Specific ID > FIFO

By default, virtually all brokerage firms (Fidelity, Schwab, E*TRADE, Vanguard, Robinhood) set your default cost basis disposal method to FIFO (First-In, First-Out). When you sell shares, FIFO sells the oldest shares first, which typically have the lowest cost basis, generating the largest possible taxable gain!

FIFO (First-In, First-Out)

Sells oldest shares first. Maximizes realized gains, increases tax liability. Worst for harvesting.

LIFO (Last-In, First-Out)

Sells newest shares first. Useful during sharp market drawdowns if recently purchased.

HIFO or Specific Identification

Recommended: Highest-In, First-Out automatically liquidates the highest cost basis lots first, minimizing gains or maximizing harvestable losses!

๐Ÿš€

6. Startup Equity & Advanced Tax Strategies

Section 83(b) elections, ISO Alternative Minimum Tax (AMT), QSBS 100% exclusions, and safe harbor rules.

Pre-IPO & High Net Worth
๐Ÿ“œ 30-Day Limit

Section 83(b) Election

For pre-IPO startup equity or restricted stock. Must be filed with IRS within strictly 30 days of grant. Pay tax on negligible initial value now; all future appreciation converts to Long-Term Capital Gains.

โš™๏ธ AMT Trap

ISO & Alternative Minimum Tax

Incentive Stock Options (ISOs) are non-taxable under regular income tax at exercise, but the spread is an AMT preference item. If stock crashes before sale, you may owe massive AMT on phantom gains!

๐Ÿ† 100% Tax Free

QSBS (Section 1202)

Qualified Small Business Stock permits up to 100% federal capital gains exclusion (up to $10M or 10x basis) if acquired directly from a qualifying C-Corp and held for at least 5 years.

๐Ÿ›ก๏ธ Avoid Penalties

Safe Harbor Estimated Taxes

Avoid IRS underpayment penalties (Form 2210) on large equity sales by withholding 110% of prior-year total tax (for AGI > $150k) or 90% of current-year total tax liability across all quarters.

๐Ÿงฎ

7. Interactive Equity & Stock Tax Calculators

Real-time simulation models for RSU vesting net proceeds, wash sale detection, and tax-loss harvesting.

Client-Side WASM / JS

๐Ÿ’Ž RSU Vesting Calculator

Net Proceeds
W-2 Gross Income at Vest: $75,000
Statutory 22% Withholding: $16,500
Actual Vest Tax Liability: $33,225
โš ๏ธ Withholding gap: $16,725 under-withheld at vest!
Capital Gain / Loss: +$15,000
Net Cash in Pocket: $49,605

๐Ÿšซ Wash Sale Simulator

IRC ยง1091
Status: WASH SALE TRIGGERED
Realized Economic Loss: -$3,000
Disallowed Current Loss: $3,000
Adjusted Replacement Basis: $105.00 / share

The $30/share loss is added to the $75 replacement share, creating a new $105 tax cost basis.

๐ŸŒพ Loss Reclaim Simulator

Schedule D
Total Capital Gains Shielded: $25,000
W-2 Ordinary Income Offset: $3,000 (Max)
Instant Cash Tax Savings: $6,910
Carryforward Bank to Next Year: $7,000
โ“

8. Frequently Asked Questions

Clear answers to nuanced equity compensation, wash sale, and tax filing queries.

Expert Insights
How do I know if my 1099-B reported my RSU cost basis as $0? โ–ผ

Inspect your Form 1099-B or Consolidated 1099 Tax Statement from your brokerage (E*TRADE, Morgan Stanley, Schwab, Fidelity). Check Box 1e (Cost or other basis) for your RSU sales. You will also receive an accompanying document titled "1099-B Supplemental Information".

If Box 1e says $0.00, or is listed under "Non-covered securities," you must report the sale on IRS Form 8949 (Part II for long-term or Part I for short-term). Enter the broker's reported Box 1e in Column (e), enter code B in Column (f), and in Column (g) enter the negative adjustment representing your vesting FMV so the net gain in Column (h) accurately reflects only the post-vest appreciation.

Does automatic dividend reinvestment (DRIP) trigger a wash sale? โ–ผ

Yes! An automatic dividend reinvestment is considered an intentional acquisition of replacement shares under IRC ยง1091. If you sell 1,000 shares of a stock at a loss on December 15, and on December 28 a quarterly dividend automatically buys 4.2 shares of that same stock, those 4.2 shares trigger a wash sale on 4.2 of your 1,000 loss shares!

To prevent this headache during active tax-loss harvesting, turn off dividend reinvestment (DRIP) on stocks or ETFs you intend to harvest, routing dividends to cash.

Why do most financial advisors recommend a "Disqualifying Disposition" for ESPP? โ–ผ

While a Qualifying Disposition offers a modest tax advantage (capping ordinary income and converting the rest to LTCG), it forces you to hold a single company's stock for up to 2 years from grant and 1 year from purchase. Single-stock volatility frequently wipes out 20% to 50% of the stock's value during bear markets.

Selling immediately on purchase day (Disqualifying Disposition) guarantees an instant 17.6% pre-tax gain on a 15% discount without bearing market risk. You pay ordinary income tax on the discount, but you instantly lock in real cash and can diversify immediately.

Does the Wash Sale Rule apply to Cryptocurrency and Bitcoin? โ–ผ

Under current IRS statutory definitions (IRC ยง1091), the wash sale rule applies to "stock or securities." Because the IRS classifies cryptocurrency as property rather than a stock or security (Notice 2014-21), crypto trades are not technically subject to statutory wash sales under federal law as of today.

However, the IRS economic substance doctrine (ยง7701(o)) still requires trades to have meaningful economic purpose besides tax evasion, and Congress has repeatedly proposed legislation to close this loophole.

What happens if I sell RSUs immediately at vesting? Are there any taxes? โ–ผ

If you sell RSUs on the day they vest, you still owe full ordinary income tax on the entire vesting value (reported on your W-2). However, because your Sale Price equals your Vesting FMV (your Cost Basis), your capital gain or loss is virtually $0.00 (minus minor broker settlement transaction fees of a few pennies).

Related Educational Guides & Tools on aiagent.org