Capital gains tax is the federal income tax—and in many states, a state income tax—on the profit from selling an investment or other capital asset for more than its cost basis. It applies to stocks, bonds, mutual funds, exchange-traded funds, real estate, cryptocurrency treated as property, and certain other assets. The headline rate can be 0%, 15%, or 20% for long-term gains, but the rules are more nuanced than a single number. This capital gains tax explained guide covers how gains are calculated, when short-term versus long-term treatment applies, which exceptions matter, and how to report and plan around the tax. It is general information, not personalized tax advice.
What Is Capital Gains Tax?

At its core, a capital gain is the difference between what you receive when you sell an asset and your adjusted cost basis. Basis generally starts with the purchase price plus certain costs, such as commissions or closing fees, and can be adjusted for reinvested dividends, improvements to property, or depreciation. If you sell for more than basis, you have a gain. If you sell for less, you have a loss.
Example: You buy 100 shares at $50 each, paying $5,000. Later you sell all 100 for $80 each, or $8,000. Your realized gain is $3,000 before any transaction costs. If you pay $20 in selling commissions, the gain is $2,980. The tax is not due merely because the investment rises in value; it is generally triggered when you realize the gain by selling or otherwise disposing of the asset.
Not every taxable investment event is a sale. Mutual funds and ETFs can distribute capital gains to shareholders, and those distributions may be taxable even if you did not sell fund shares. Qualified dividends also receive long-term capital gains treatment, though they are not capital gains in the technical sense. The IRS treats virtual currency as property, so selling or exchanging it can produce a capital gain or loss.
Short-Term vs. Long-Term Capital Gains
The holding period is central. If you held the asset for more than one year, the gain is long-term and may qualify for preferential rates. If you held it for one year or less, the gain is short-term and is generally taxed at ordinary income rates—the same rates that apply to wages, interest, and other ordinary income. The holding period generally begins the day after you acquire the asset and ends on the day you sell it.
| Holding period | Classification | Typical federal tax treatment | | --- | --- | --- | | One year or less | Short-term | Ordinary income rates, generally 10% to 37% | | More than one year | Long-term | Preferential rates, generally 0%, 15%, or 20% |
Those ranges are general. Your actual rate depends on taxable income, filing status, and other income. A short-term gain can push you into a higher ordinary bracket, and a long-term gain can push you from the 0% to the 15% or 20% capital gains bracket. Because the capital gains brackets are based on total taxable income, the gain is stacked on top of other income when the IRS calculates the rate.
Example: Suppose a single filer has $40,000 of ordinary taxable income and a $20,000 long-term capital gain. The gain is added to taxable income, so part of it may fall in the 0% bracket and part in the 15% bracket. The result is not simply 15% on the entire gain. Software or a tax professional generally performs this stacking calculation.
How Capital Gains Tax Is Calculated
Start with proceeds, subtract adjusted basis, and account for transaction costs. For securities, basis includes the purchase price and commissions; for real estate, it can include closing costs, certain improvements, and selling expenses. Reinvested dividends and capital gain distributions increase basis because you already paid tax on them. Depreciation claimed on rental property reduces basis and may be subject to depreciation recapture at ordinary rates.
After calculating gains and losses, you net them. Short-term gains and losses are netted against each other, and long-term gains and losses are netted against each other. If one category has a net loss, it can offset net gain in the other category. If total capital losses exceed total capital gains, you can generally deduct up to $3,000 of excess loss against ordinary income per year ($1,500 if married filing separately). Remaining losses can carry forward to future years, subject to rules.
Example: You have a $10,000 long-term gain, a $4,000 long-term loss, and a $2,000 short-term gain. Net long-term gain is $6,000; net short-term gain is $2,000. You generally have $8,000 of net capital gain, with $6,000 taxed at long-term rates and $2,000 at ordinary rates. If instead you had a $9,000 net capital loss, you could deduct $3,000 against ordinary income and carry $6,000 forward, assuming no other limitations.
Wash-sale rules matter for losses. If you sell a security at a loss and buy a substantially identical security within 30 days before or after the sale, the loss may be disallowed for current tax purposes and added to the basis of the replacement security. The rule is designed to prevent taxpayers from claiming a loss while maintaining the same economic position.
Capital Gains Tax Rates and Brackets
For long-term gains, the federal rates are generally 0%, 15%, and 20%, depending on taxable income. For tax year 2025, the 0% rate applied to taxable income up to $48,350 for single filers and $96,700 for married couples filing jointly. The 15% rate applied above those amounts up to $533,400 for single filers and $600,050 for joint filers. The 20% rate applied above those thresholds. Those figures are inflation-adjusted and change; check the IRS for the year you are filing.
Higher-income investors may also owe the net investment income tax. The NIIT is 3.8% on the lesser of net investment income or modified adjusted gross income above $200,000 for single filers, $250,000 for married couples filing jointly, and $125,000 for married filing separately. The thresholds are not inflation-adjusted. Net investment income can include interest, dividends, capital gains, rental income, and certain passive business income.
State taxes can change the picture. Many states tax capital gains as ordinary income, some offer preferential treatment, and some have no personal income tax. Local taxes may also apply. As a result, the federal rate is only one part of the total tax cost.
Short-term gains are generally taxed at ordinary rates. For 2025, ordinary federal rates ranged from 10% to 37%, depending on taxable income and filing status. Qualified dividends and long-term capital gain distributions generally use the same 0%, 15%, and 20% structure as long-term gains.
Exceptions and Special Rules
Several exceptions can reduce or defer capital gains tax. The most common is the home sale exclusion. If you owned and used a home as your principal residence for at least two of the five years before the sale, you may exclude up to $250,000 of gain if single and up to $500,000 if married filing jointly, provided you meet the tests. Partial exclusions can apply in certain circumstances, such as a change in health, employment, or unforeseen events.
Retirement accounts receive different treatment. Gains inside traditional IRAs and 401(k)s are generally not taxed annually; withdrawals are taxed as ordinary income under the account rules. Roth accounts generally offer tax-free qualified withdrawals. This means asset location—holding tax-inefficient investments in tax-advantaged accounts—can matter as much as the investments themselves.
Gifts and inheritances have their own rules. Giving appreciated assets to a qualified charity can avoid recognizing the gain, subject to substantiation and limitation rules. Inherited assets generally receive a basis step-up to fair market value at the date of death, though exceptions exist. Gifting appreciated assets to family members can shift the gain, but the kiddie tax and gift tax rules may apply.
Certain small-business stock, opportunity zone investments, and other provisions can defer or exclude gain, but they are narrow and fact-specific. Do not assume an exception applies without checking the requirements.
Strategies to Manage Capital Gains Tax
Tax planning should start before a sale. Consider these common, legitimate approaches:
- Hold long-term when practical. Crossing the one-year holding period can move a gain from ordinary rates to preferential rates. Do not let the tax tail wag the investment dog, but the holding period is worth checking before selling.
- Harvest losses carefully. Realizing losses can offset gains and up to $3,000 of ordinary income per year, with carryforwards. Watch the wash-sale rule and make sure the sale fits your investment plan.
- Manage bracket thresholds. Because long-term gains stack on top of ordinary income, spreading sales across tax years may keep more gain in the 0% or 15% bracket. This is not guaranteed and depends on future income and law changes.
- Use tax-advantaged accounts. Hold high-turnover funds or taxable bonds in retirement accounts when appropriate, and keep tax-efficient broad index funds in taxable accounts. Asset location is not a substitute for diversification.
- Consider charitable giving. Donating appreciated shares can be more tax-efficient than selling and donating cash, if you itemize and meet the rules.
- Plan for estimated taxes. If you expect to owe at least $1,000 in federal tax after withholding and credits, you may need to make quarterly estimated payments or increase withholding to avoid an underpayment penalty.
These strategies can reduce tax, but they cannot eliminate it in every case. Investment returns, tax law, and your personal circumstances can change.
Reporting and Paying Capital Gains Tax
Most individual taxpayers report capital gains on Form 8949 and Schedule D, which flow to Form 1040. Brokers generally issue Form 1099-B, and the IRS may receive a copy. Check the reported basis and proceeds; corrected basis is a common issue, especially for employees who sell employer stock or for investments transferred between brokers.
Keep records of purchase dates, cost basis, commissions, reinvested dividends, and improvements. For property, retain closing statements and receipts for capital improvements. Good records matter if the IRS asks questions and can help you avoid overpaying tax.
Pay attention to timing. Short-term gains are included in ordinary income, while long-term gains and qualified dividends are reported separately. If you have significant gains, review withholding and estimated payments before year-end. State returns may require separate treatment and estimated payments.
This article is general information. Tax law is complex and changes. Consider consulting a qualified tax professional or CPA for your situation.
Bottom Line
Capital gains tax is generally owed when you sell an investment or other capital asset for more than your basis. The rate depends on holding period, taxable income, filing status, and the type of asset. Long-term gains may qualify for 0%, 15%, or 20% federal rates; short-term gains generally follow ordinary income rates. The 3.8% net investment income tax and state taxes can add to the bill. Calculate basis carefully, net gains and losses, watch exceptions such as the home sale exclusion, and report the results on Form 8949 and Schedule D. Planning ahead—especially around holding periods, loss harvesting, and estimated taxes—can help you manage the tax rather than be surprised by it.


