What Is Capital Gains Tax?
A capital gains tax is a federal (and often state) tax levied on the profit you earn when you sell a capital asset — such as stocks, mutual funds, real estate, cryptocurrency, bonds, or collectibles — for more than you originally paid. The difference between the sale price and your original purchase price (your cost basis) is called a capital gain. That gain is what the IRS taxes.
For example, if you bought 100 shares of a stock at $50 each and sold them at $120 each, your capital gain is $7,000 ($12,000 − $5,000). You owe tax on that $7,000, not on the full $12,000 sale price.
Capital gains taxes are one of the most impactful taxes for investors, retirees selling property, and anyone who builds wealth outside of a regular paycheck. Understanding how they work — and how to legally minimize them — can save you thousands of dollars every year. Our capital gains tax calculator above makes the math instant.
How Is Capital Gains Tax Calculated?
The IRS calculates capital gains tax in three steps:
- Determine your cost basis. This is what you paid for the asset, including brokerage commissions, closing costs (for real estate), or any improvements that add to value.
- Subtract the cost basis from the sale price. Proceeds minus basis equals your gross gain (or loss). Also subtract selling costs — agent commissions, transfer taxes, etc.
- Apply the correct tax rate. The rate depends on how long you held the asset (short-term vs. long-term) and your total taxable income for the year.
Capital Gains Tax Formula
Capital Gain = Sale Price − Cost Basis − Selling Expenses
Tax Owed = Capital Gain × Applicable Tax Rate
Net capital losses (when you lose money on investments) can offset gains dollar-for-dollar. If losses exceed gains, up to $3,000 per year can be deducted against ordinary income, with any remaining losses carried forward to future years.
Want to see this in action for your situation? Use the free capital gains tax calculator at the top of this page.
Short-Term vs. Long-Term Capital Gains
The single most important factor in calculating capital gains tax is your holding period — how long you owned the asset before selling it.
⚡ Short-Term Capital Gains
- ✦ Asset held 1 year or less
- ✦ Taxed as ordinary income
- ✦ Rate: 10% – 37% depending on your bracket
- ✦ Same rate as your wages and salary
- ✦ No preferential treatment from IRS
- ✦ Day traders and flippers often face this rate
🏆 Long-Term Capital Gains
- ✦ Asset held more than 1 year
- ✦ Taxed at preferential rates
- ✦ Rate: 0%, 15%, or 20%
- ✦ Significantly lower than ordinary income rates
- ✦ One of the biggest tax advantages for investors
- ✦ Can result in $0 tax if income is low enough
The tax difference is dramatic. A single filer in the 32% income bracket who sells a stock after 11 months pays 32% on the gain. If they wait just one more month — past the 12-month mark — that rate drops to 15%. On a $50,000 gain, that's a difference of $8,500 in taxes from a single decision about timing.
Use our long-term capital gains tax calculator and short-term capital gains tax calculator to compare both scenarios side by side.
2026 Capital Gains Tax Rates & Brackets
The IRS adjusts income thresholds annually for inflation. Here are the official 2026 long-term capital gains tax brackets:
2026 Long-Term Capital Gains Tax Rates
| Rate | Single Filers | Married Filing Jointly | Head of Household |
|---|---|---|---|
| 0% | $0 – $48,350 | $0 – $96,700 | $0 – $64,750 |
| 15% | $48,351 – $533,400 | $96,701 – $600,050 | $64,751 – $566,700 |
| 20% | Over $533,400 | Over $600,050 | Over $566,700 |
Source: IRS Revenue Procedure 2025-32. Thresholds apply to taxable income including the capital gain.
2026 Short-Term Capital Gains Tax Rates (Ordinary Income Brackets)
Short-term gains are taxed at your regular income tax rate. For 2026, the federal income tax brackets for a single filer are:
| Tax Rate | Single | Married Joint |
|---|---|---|
| 10% | Up to $11,925 | Up to $23,850 |
| 12% | $11,926 – $48,475 | $23,851 – $96,950 |
| 22% | $48,476 – $103,350 | $96,951 – $206,700 |
| 24% | $103,351 – $197,300 | $206,701 – $394,600 |
| 32% | $197,301 – $250,525 | $394,601 – $501,050 |
| 35% | $250,526 – $626,350 | $501,051 – $751,600 |
| 37% | Over $626,350 | Over $751,600 |
Source: IRS Rev. Proc. 2025-32. These brackets determine the short-term capital gains tax rate applied to assets held 1 year or less.
Not sure which bracket you fall into? Our tax bracket calculator and marginal tax rate calculator can help you figure out your exact rate before you calculate capital gains.
Capital Gains Tax Formula & Real-Life Examples
Example 1: Selling Stocks (Long-Term)
Scenario
- Purchase price: $20,000
- Sale price: $55,000
- Holding period: 18 months
- Filing status: Single
- Taxable income (before gain): $75,000
Calculation
- Capital gain: $55,000 − $20,000 = $35,000
- Taxable income including gain: $110,000
- Long-term rate (single, $110K): 15%
- Tax owed: $35,000 × 15% = $5,250
Example 2: Selling Stocks (Short-Term)
Same Scenario — Sold After 8 Months
- Capital gain: $35,000 (same)
- Regular income: $75,000
- Ordinary income bracket at $110K: 22%
- Short-term tax owed: $35,000 × 22% = $7,700
💡 Waiting 10 more months saved $2,450 in this example — purely by qualifying for long-term rates.
Example 3: Selling a Home (Primary Residence Exclusion)
Scenario
- Purchase price: $250,000
- Sale price: $600,000
- Gross gain: $350,000
- Filing status: Married filing jointly
- Lived in home: 3 of last 5 years
Calculation
- Section 121 exclusion (MFJ): $500,000
- Taxable gain: $350,000 − $500,000 = $0
- Tax owed: $0
- Full gain excluded!
For more complex home-sale scenarios, check our federal income tax calculator to model your total tax picture after a large gain.
How to Calculate Capital Gains Tax on Real Estate
Real estate capital gains tax is one of the most commonly searched topics — and for good reason. Home values have surged in many U.S. markets, meaning sellers are sitting on large gains. Here's everything you need to know.
Primary Residence: The Section 121 Exclusion
If you sell your primary home, the IRS allows you to exclude a significant portion of your gain from tax under IRC Section 121:
- Single filers: Up to $250,000 of gain excluded
- Married filing jointly: Up to $500,000 of gain excluded
- You must have owned and lived in the home for at least 2 of the last 5 years
- The exclusion can only be used once every 2 years
Any gain above the exclusion limit is taxable at long-term rates (assuming you owned the home for over a year).
Investment Property & Rental Property
Investment properties — rentals, vacation homes, land — do not qualify for the Section 121 exclusion. Your capital gains on these properties are taxed at standard long-term or short-term rates based on holding period.
There's an important wrinkle: depreciation recapture. If you've been depreciating a rental property (which the IRS actually requires), the portion of your gain attributable to past depreciation deductions is taxed at a special 25% rate — not the standard 0%/15%/20% capital gains rates.
How to Calculate Capital Gains Tax on Sale of Property
Step-by-Step for Rental Property Sale
- Start with your adjusted cost basis: purchase price + improvements − accumulated depreciation
- Subtract the adjusted basis from the net sale proceeds (sale price minus selling costs)
- Identify the depreciation recapture portion — taxed at max 25%
- The remaining gain is taxed at long-term capital gains rates (0%, 15%, or 20%)
- Check if NIIT applies (3.8% surtax if income exceeds thresholds)
The 1031 Exchange: Defer Capital Gains Tax on Real Estate
Under IRC Section 1031, you can defer capital gains tax by reinvesting the proceeds from selling one investment property into a like-kind replacement property. Key rules:
- You must identify the replacement property within 45 days of sale
- The exchange must close within 180 days of the sale
- The new property must be of equal or greater value
- Tax is deferred, not eliminated — it carries over to the new property
- 1031 exchanges only apply to investment/business properties, not primary homes
💡 Farmland Capital Gains
How to calculate capital gains tax on farmland follows the same rules as other investment real estate — holding period determines short vs. long-term rates. However, farmland may qualify for 1031 exchanges, and special installment sale elections can spread the tax liability over several years.
Capital Gains Tax on Stocks, Mutual Funds & Crypto
How to Calculate Capital Gains Tax on Stock Sales
For stocks, your cost basis is the price you paid per share, multiplied by the number of shares. When you buy the same stock at different times (different prices), you must choose an accounting method:
- FIFO (First In, First Out): The IRS default. The oldest shares are sold first. May result in higher gains if shares have appreciated significantly.
- Specific Identification: You choose which specific shares to sell, giving you precise control over gains and losses. Best for tax optimization.
- Average Cost: Only allowed for mutual fund shares. Averages the cost across all purchases.
Mutual Funds and ETFs: Two Layers of Taxation
With mutual funds and ETFs, you face capital gains taxes at two levels:
- Fund distributions: When the fund sells holdings internally, it passes capital gain distributions to shareholders — even if you didn't sell your shares. These are reported on your 1099-DIV.
- When you sell fund shares: Your gain or loss is the difference between your sale price and your cost basis in the fund.
How Cryptocurrency Capital Gains Tax Works
The IRS treats cryptocurrency as property (not currency). This means every time you sell, trade, or spend crypto, it is a taxable event. This includes:
- Selling Bitcoin, Ethereum, or any other crypto for U.S. dollars
- Trading one cryptocurrency for another (e.g., Bitcoin → Ethereum)
- Using crypto to buy goods or services
- Receiving crypto as payment for work (taxed as ordinary income at receipt)
Short-term vs. long-term rules apply the same way. Hold crypto for more than a year and you qualify for the preferential long-term rates (0%, 15%, or 20%). Sell sooner and it's taxed as ordinary income. For crypto calculations, you can use specific identification (FIFO, LIFO, or HIFO) to choose which coins you're selling — HIFO (Highest In, First Out) typically minimizes your taxable gain.
Our crypto capital gains tax calculator applies the same IRS property rules to help you estimate what you'll owe on digital asset sales.
RSUs and Stock Options
Restricted Stock Units (RSUs) and employee stock options have a two-step tax process. First, when RSUs vest (or options are exercised), the value is taxed as ordinary income. Then, when you sell the shares, any additional appreciation is a capital gain (short or long-term based on how long you held after vesting/exercise).
Net Investment Income Tax (NIIT): The 3.8% Surtax
High-income taxpayers face an additional 3.8% Net Investment Income Tax (NIIT) on top of regular capital gains tax. This surtax was introduced by the Affordable Care Act and applies to investment income for taxpayers above these Modified Adjusted Gross Income (MAGI) thresholds:
| Filing Status | MAGI Threshold | Max Effective Rate (LT) |
|---|---|---|
| Single | $200,000 | 23.8% |
| Married Filing Jointly | $250,000 | 23.8% |
| Married Filing Separately | $125,000 | 23.8% |
| Head of Household | $200,000 | 23.8% |
The 3.8% NIIT applies to the lesser of net investment income or the amount MAGI exceeds the threshold. NIIT thresholds are NOT inflation-adjusted.
The NIIT applies to capital gains, dividends, rental income, interest, and passive business income. It does not apply to wages, active business income, Social Security benefits, or distributions from IRAs and 401(k)s.
At the highest bracket, the true maximum federal capital gains rate is 23.8% (20% + 3.8% NIIT) — plus any applicable state tax. Pair this with our federal income tax calculator to see your complete federal tax liability.
State Capital Gains Taxes by State
On top of federal capital gains tax, most states impose their own tax on capital gains. Unlike the federal government, most states do not offer preferential long-term rates — they tax capital gains at the same rate as ordinary income.
Capital Gains Tax by State (2026)
| State | Capital Gains Tax Rate | Notes |
|---|---|---|
| Florida, Texas, Nevada, Wyoming, South Dakota, Alaska, Washington (most income) | 0% | No state income tax |
| California | Up to 13.3% | Taxed as ordinary income; highest in U.S. |
| New York | Up to 10.9% | Ordinary income rates; NYC adds more |
| New Jersey | Up to 10.75% | Ordinary income rates |
| Oregon | Up to 9.9% | Ordinary income rates |
| Minnesota | Up to 9.85% | Ordinary income rates |
| Massachusetts | 5% / 8.5% | 5% long-term; 8.5% short-term |
| Washington State | 7% | On long-term gains above $262,000 |
| Ohio, Indiana, Pennsylvania | 3–4.99% | Flat or near-flat rates |
Rates may change. Consult a tax professional for your specific state situation.
California has the highest combined capital gains tax burden in the nation. A California resident in the top bracket can pay up to 37.1%combined federal and state on short-term gains (37% federal + 13.3% state = 50.3% combined on short-term gains — though the state isn't applied to federal after-tax income, so effective rates are somewhat lower). This is a major reason high-income Californians often relocate before selling large assets.
10 Proven Strategies to Minimize Capital Gains Tax
The IRS offers legal — and powerful — ways to reduce what you owe on capital gains. Here are the most effective strategies used by investors and tax professionals:
Hold Assets for More Than One Year
The simplest and most impactful strategy. Converting a short-term gain (taxed up to 37%) to a long-term gain (taxed at 0–20%) can cut your tax bill in half or more. If you're close to the 12-month mark, it almost always pays to wait.
Tax-Loss Harvesting
Sell losing investments to offset gains dollar-for-dollar. If losses exceed gains, up to $3,000 can offset ordinary income per year, with the rest carried forward indefinitely. Be mindful of the wash-sale rule — don't repurchase substantially identical securities within 30 days.
Max Out Tax-Advantaged Accounts (IRA, 401k, HSA)
Investments inside a Roth IRA, Traditional IRA, or 401(k) grow without annual capital gains tax. A Roth IRA is especially powerful — qualified withdrawals are 100% tax-free, including all growth. Our retirement calculator can show you the long-term impact.
Time Your Sales Around Income
If you expect significantly lower income in an upcoming year (retiring, career gap, large deductions), consider delaying a gain until then. Lower income = lower or zero capital gains tax rate.
Use the 0% Rate Strategically
If your taxable income falls below the 15% threshold ($48,350 single in 2026), you pay $0 federal tax on long-term capital gains. Retirees with low income can often realize gains completely tax-free — a strategy called "gain harvesting."
Donate Appreciated Assets to Charity
Donating appreciated stocks or property to a qualified charity gives you a deduction for the full fair market value while avoiding capital gains tax entirely. Much more tax-efficient than selling the asset and donating cash.
Utilize the Primary Residence Exclusion
The Section 121 exclusion is one of the biggest tax breaks available. Single filers exclude $250,000; married couples exclude $500,000. Keep records of home improvements — they increase your cost basis and reduce taxable gain.
1031 Exchange for Investment Properties
Defer all capital gains (and depreciation recapture) by rolling sale proceeds into a like-kind investment property. Properly structured, you can exchange indefinitely, passing assets to heirs who receive a stepped-up basis.
Gift Assets to Family in Lower Brackets
Gifts of appreciated stock to family members in the 0% capital gains bracket can allow the gain to be realized tax-free. Annual gift tax exclusion is $18,000 per recipient in 2026. Be careful of the "kiddie tax" rules for children under 19.
Qualified Opportunity Zone Investments
Invest capital gains in a Qualified Opportunity Fund within 180 days of sale. This defers the original gain and — if held 10+ years — eliminates all new appreciation in the opportunity zone investment entirely.
📋 Capital Gains Tax Disclaimer
This calculator and content are for educational purposes only and do not constitute tax, legal, or financial advice. Tax laws change frequently. For personalized guidance, consult a licensed CPA, tax attorney, or enrolled agent. Always verify figures with the official IRS website (irs.gov) and current-year IRS publications.
More Free Tax & Financial Calculators
Capital gains tax doesn't exist in isolation — it affects your total tax picture. Use these free tools to get the full view:
Federal Income Tax Calculator
Calculate your total federal tax including capital gains impact
Tax Bracket Calculator
Find out exactly which bracket your income falls into
Marginal Tax Rate Calculator
Calculate your effective and marginal income tax rates
Paycheck Calculator
Estimate take-home pay after all deductions and taxes
Tax Refund Calculator
Estimate your federal tax refund or amount owed
Retirement Calculator
See how tax-advantaged accounts reduce capital gains exposure
Salary Calculator
Convert annual salary to hourly, monthly, and net pay
Investment Return Calculator
Project investment growth accounting for taxes