Free Financial Tool
Capital Gains Tax
Calculator
Calculate the exact tax on your stock sales, real estate, crypto, and RSU gains. Long-term vs. short-term rates, NIIT, state taxes, and multi-lot support. Know what you owe before you sell.
Quick Start Presets
Your Investment Sale
What you paid
What you sold for
Your ordinary income (W-2, 1099, etc.) before this sale
Total Gain
+$5,000
Federal Tax
$750
State Tax
$0
0.00% rate
Total Tax Owed
$750
Net Proceeds
$14,250
After all taxes
Effective Tax Rate
15.00%
Total tax / total gain
Long-Term vs. Short-Term Breakdown
Long-Term Gains
$5,000
Federal tax
$750
15.00% effective
Long-Term Capital Gains Bracket Breakdown
Long-Term Bracket Position
Key Insight
At 15.00%, your effective capital gains rate is relatively favorable. The preferential long-term rate saves you significant money compared to ordinary income tax rates. Every year you hold reduces your tax cost.
Complete Tax Breakdown
Every component of your capital gains tax liability
| Component | Amount | Tax |
|---|---|---|
| Long-term capital gains (federal) | $5,000.00 | $750.00 |
| Total Tax Liability | $750.00 | |
Get Glen's Musings
Occasional thoughts on AI, Claude, investing, and building things. Free. No spam.
Unsubscribe anytime. I respect your inbox more than Congress respects property rights.
Recommended Resources
Tools & books I actually use and recommend
TradingView
Best charting platform out there. Real-time data, screeners, and a community of millions of traders.
Try TradingViewThe Psychology of Money
Morgan Housel on why managing money is about behavior, not intelligence. Short, brilliant chapters you'll re-read.
View on AmazonThe Intelligent Investor
Ben Graham's timeless guide to value investing. The book Warren Buffett calls "the best investing book ever written."
View on AmazonSome links above are affiliate links. I only recommend products I personally use. See my full disclosures.
The Complete Guide to Capital Gains Taxes
I have paid more in capital gains taxes than most people earn in a year. That is not a brag -- it is a confession. For years I sold positions without thinking about tax consequences, and it cost me tens of thousands of dollars in unnecessary taxes. Here is everything I have learned the hard way, so you do not have to repeat my mistakes.
Long-Term vs. Short-Term Capital Gains: The Most Expensive Mistake
The single biggest tax mistake individual investors make is selling winners before the one-year mark. Short-term capital gains are taxed at your ordinary income tax rate -- which can be as high as 37%. Long-term gains get preferential rates of 0%, 15%, or 20%. That difference can easily be 15-20 percentage points on the same gain.
Here is a concrete example: You buy $50,000 worth of stock and sell it for $75,000. Your gain is $25,000. If you are a single filer making $100,000 and you sell after 11 months, that $25,000 is taxed at 24% (your marginal ordinary income bracket), costing you $6,000 in federal tax. But if you wait one more month and sell at the 13-month mark, the same gain is taxed at 15%, costing you only $3,750. You just saved $2,250 by being patient for 30 days. Multiply that across a lifetime of investing and the difference is enormous.
2025 Long-Term Capital Gains Brackets
| Rate | Single | Married Joint |
|---|---|---|
| 0% | Up to $48,350 | Up to $96,700 |
| 15% | $48,350 - $533,400 | $96,700 - $600,050 |
| 20% | Over $533,400 | Over $600,050 |
These brackets are based on your total taxable income, not just your gains. Your gains “stack” on top of ordinary income to determine the rate.
The Net Investment Income Tax (NIIT): The Hidden 3.8%
Most people do not know about the NIIT until it shows up on their tax return. If your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly), you pay an additional 3.8% tax on your investment income. This includes capital gains, dividends, interest, rental income, and royalties.
The NIIT was introduced as part of the Affordable Care Act in 2013 and applies to the lesser of your net investment income or the amount by which your MAGI exceeds the threshold. The thresholds are not indexed for inflation, which means more people fall into it every year. For high earners, the maximum federal rate on long-term gains is effectively 23.8% (20% + 3.8%), not 20%.
Tax Loss Harvesting: Free Money Every December
Tax loss harvesting is the practice of selling losing investments to realize capital losses, which offset your capital gains. Here is how the math works: losses first offset gains of the same type (short-term losses cancel short-term gains, long-term losses cancel long-term gains). Then excess losses cross over to offset the other type. And if you still have net losses after all that, you can deduct up to $3,000 per year against ordinary income, with unlimited carryforward.
I harvest losses every December without exception. Even in a great year, there are always individual positions that are down. Selling them to lock in the loss, then buying a similar (but not identical) investment to maintain exposure, is one of the few genuinely free lunches in investing. Over a 30-year investing career, disciplined tax loss harvesting can add 0.5-1.0% to your annual after-tax returns.
The Wash Sale Rule: Do Not Trip This Wire
The wash sale rule is the IRS's defense against aggressive tax loss harvesting. If you sell a security at a loss and buy a “substantially identical” security within 30 days before or after the sale, the loss is disallowed. The disallowed loss gets added to the cost basis of the replacement shares, so you do not lose the deduction forever -- it is just deferred.
Key things to know: the 30-day window applies in both directions (30 days before AND 30 days after). It applies across ALL your accounts, including IRAs. And “substantially identical” means you cannot sell the Vanguard S&P 500 fund and immediately buy the identical Vanguard S&P 500 fund. But you could buy a similar Fidelity S&P 500 fund -- the IRS has not clarified whether different funds tracking the same index are “substantially identical,” and in practice most advisors treat them as acceptable substitutes.
How to Minimize Capital Gains Taxes
Hold investments for at least one year
The single easiest tax optimization. Converting short-term gains (up to 37%) to long-term gains (0-20%) can save you 10-17 percentage points on every dollar of profit. Set a calendar reminder and do not sell early unless the investment thesis is broken.
Harvest losses aggressively
Every December, review your portfolio for losing positions. Sell them to realize the loss, wait 31 days (or buy a similar fund immediately), and claim the tax deduction. Over a lifetime, this adds up to tens of thousands in tax savings.
Use tax-advantaged accounts for high-turnover strategies
If you trade frequently, do it inside a Roth IRA or 401(k) where there are no capital gains taxes. Keep your buy-and-hold positions in taxable accounts where you benefit from the long-term rate and stepped-up basis at death.
Donate appreciated shares instead of cash
If you donate to charity, donate appreciated stock instead of cash. You get a deduction for the full market value and avoid paying capital gains tax on the appreciation entirely. This is the most tax-efficient way to give.
Spread large gains across multiple tax years
If you have a massive gain (selling a business, exercising ISOs, liquidating a concentrated position), consider spreading sales across December and January to split the gain across two tax years. This can keep you in lower brackets both years.
Stay under the NIIT threshold when possible
If your income is near $200K (single) or $250K (married), consider timing sales to years when your income is lower. The 3.8% NIIT adds up fast on large gains. Even small income timing adjustments can save you thousands.
State Capital Gains Taxes: The Second Bite
Federal taxes are only part of the picture. Most states tax capital gains as ordinary income, which means your state marginal rate applies on top of the federal rate. California's top rate of 13.3% means a high-income Californian can pay 37.1% all-in on long-term capital gains (20% + 3.8% NIIT + 13.3% state). Meanwhile, Florida, Texas, Nevada, Washington, Wyoming, South Dakota, Alaska, Tennessee, and New Hampshire have no state income tax on investment gains.
This is why so many tech founders, hedge fund managers, and retirees relocate to no-income-tax states before a major liquidity event. The tax savings on a single large sale can pay for the move many times over. I live in Miami Beach partly for this reason -- Florida has no state income tax, which saves me thousands every year on my trading gains.
Frequently Asked Questions
What is the difference between long-term and short-term capital gains?
Long-term capital gains apply to assets held for more than one year. They are taxed at preferential rates of 0%, 15%, or 20% depending on your taxable income. Short-term capital gains apply to assets held for one year or less and are taxed at your ordinary income tax rate, which can be as high as 37%. This difference alone can save or cost you thousands of dollars, which is why holding period matters enormously.
What is the Net Investment Income Tax (NIIT)?
The NIIT is an additional 3.8% tax on investment income (including capital gains, dividends, interest, and rental income) that applies when your modified adjusted gross income exceeds $200,000 for single filers or $250,000 for married filing jointly. The tax applies to the lesser of your net investment income or the amount by which your MAGI exceeds the threshold. This means high-income investors can pay up to 23.8% on long-term capital gains (20% + 3.8% NIIT).
How does tax loss harvesting reduce capital gains taxes?
Tax loss harvesting is the strategy of selling losing investments to offset capital gains. Losses first offset gains of the same type (short-term losses offset short-term gains, long-term losses offset long-term gains). Then excess losses offset gains of the other type. If you still have net losses after offsetting all gains, you can deduct up to $3,000 per year against ordinary income, with unlimited carryforward to future years. This is free money every December for anyone with a taxable brokerage account.
What is the wash sale rule?
The wash sale rule prevents you from claiming a tax loss if you buy a 'substantially identical' security within 30 days before or after the sale. If triggered, the disallowed loss is added to the cost basis of the replacement shares, deferring (not eliminating) the tax benefit. This applies across all your accounts, including IRAs. To avoid it, wait 31 days before repurchasing, or buy a similar but not identical investment (e.g., a different index fund tracking the same index from a different provider).
Do I pay capital gains tax on my primary residence?
If you have lived in your home for at least 2 of the last 5 years, you can exclude up to $250,000 of gain ($500,000 for married filing jointly) from capital gains tax under the Section 121 exclusion. Any gain above the exclusion amount is taxed at long-term capital gains rates. This is one of the most powerful tax benefits available to homeowners and is a major reason why primary residences are tax-advantaged investments.
How are RSUs (Restricted Stock Units) taxed?
RSUs are taxed in two stages. First, when they vest, the fair market value is taxed as ordinary income (your employer withholds taxes). Second, if you hold the shares after vesting and sell later at a higher price, the gain above the vest price is taxed as a capital gain -- long-term if held more than one year after vesting, short-term if sold within one year. Many RSU recipients sell immediately at vest, which means zero capital gain (only the ordinary income portion applies).
What are the 2025 long-term capital gains tax brackets?
For 2025, the long-term capital gains brackets are: 0% for taxable income up to $48,350 (single) or $96,700 (married filing jointly); 15% for income up to $533,400 (single) or $600,050 (married filing jointly); and 20% for income above those thresholds. These brackets are based on your total taxable income, not just your capital gains. Your gains 'stack' on top of your ordinary income to determine which bracket they fall into.
Know Your Tax Before You Sell
Scroll back up and model different scenarios. Change holding periods, try different income levels, add multiple lots. The difference between a smart sale and a costly one is often just timing.
Keep Optimizing Your Tax Strategy
Tax Bracket Calculator
See exactly how federal income tax brackets apply to your income with a visual bracket-by-bracket breakdown.
Read moreCalculatorInvestment Fee Calculator
High fees are the other silent killer of returns. See how much your fund expenses actually cost you over 30 years.
Read moreAnalysisMy Trading Analysis
2,068 real trades from my Schwab account, analyzed. See every win, every loss, every lesson learned.
Read moreTransparencyMy Worst Trades
The trades that cost me the most money and the most sleep. Complete with pain meters.
Read moreToolCompare Your Returns
Benchmark your investment performance against Buffett, the S&P 500, and my actual track record.
Read moreCalculatorFIRE Calculator
Find your financial independence number. See when you can retire and how capital gains taxes affect the path.
Read moreGet Glen's Musings
Occasional thoughts on AI, Claude, investing, and building things. Free. No spam.
Unsubscribe anytime. I respect your inbox more than Congress respects property rights.