Capital gains tax is the federal, and often state, tax you owe on the profit when you sell an investment for more than you paid for it. The IRS takes what you received, subtracts your cost basis, and taxes the difference at a rate set by how long you held the asset and how much total income you have.
You do not owe federal capital gains tax simply because an investment went up. You owe it when the gain is realized, which usually means a sale, an exchange, or a fund distributing its own gains to you.
Rates and thresholds move with inflation adjustments and legislative changes, so treat every figure here as general information for the 2026 tax year and confirm the current numbers with the IRS or a tax professional before filing.
Table of Contents
- What Is Capital Gains Tax?
- How Capital Gains Tax Works on Investments
- Step 1: Calculate the Gain or Loss
- Step 2: Classify the Gain as Short-Term or Long-Term
- Step 3: Apply the Applicable Federal Rate
- Short-Term vs. Long-Term Capital Gains: Key Differences
- What Happens When You Sell Different Investments?
- How the IRS Calculates the Tax You Owe
- Can Capital Losses Reduce Your Tax Bill?
- When Do You Owe Capital Gains Tax?
- How Investors Report Capital Gains and Losses
- Ways Investors Can Manage Capital Gains Tax
- Frequently Asked Questions
- Do I owe capital gains tax if my investments went up but I did not sell them?
- How long do I have to hold an investment for long-term capital gains tax rates?
- What counts as the cost basis when I buy stocks, ETFs, or mutual funds?
- Can I deduct a capital loss if I did not sell the losing investment?
- Does a capital gains tax apply to dividends and interest?
- Do capital gains taxes apply to cryptocurrency transactions?
- Conclusion: What to Do First
What Is Capital Gains Tax?
Capital gains tax applies to the profit you earn from selling a capital asset for more than your basis in it. If you bought something for $2,000 and sold it for $3,400, the taxable amount is $1,400. The $2,000 you put in is returned to you tax-free.
That profit-only rule is the part most people get wrong. Nobody taxes the full $3,400. What matters is the difference between what came in and what you originally paid, plus whatever adjustments apply to the basis.
Not all investment income is capital gain. Interest from a savings account or a money market fund is ordinary income, taxed at your marginal rate no matter how long you held it. Qualified dividends from U.S. companies and most regulated investment company (RIC) distributions are taxed at the same preferential rates as long-term capital gains, but they are reported and taxed separately.
Transactions that commonly create a taxable capital gain include selling a stock, ETF or mutual fund share, selling a bond, trading cryptocurrency for dollars or another coin, selling real estate, and exchanging one investment for another of a different type. Selling part of a position counts just as much as closing it out.
The starting point for the federal rules is IRS Topic No. 409, Capital Gains and Losses, with the detail in Publication 550, Investment Income and Expenses.
How Capital Gains Tax Works on Investments

The process runs in five moves: identify what you sold, compute the gain or loss, classify it by holding period, apply the matching rate, and report it on your return. Nothing is owed at the moment of the trade. The bill arrives when you file.
Step 1: Calculate the Gain or Loss
Gain equals the amount you received minus your adjusted cost basis. If you bought 100 shares at $45.00 each and later sold them at $62.50, your proceeds are $6,250 and your basis is $4,500, so the gain is $1,750 before any adjustments.
Adjusted basis is your purchase price plus certain additions and minus certain deductions. Brokerage commissions and fees that you paid to acquire or sell the investment are added to basis. Reinvested mutual fund distributions are added too, which quietly raises your basis each year without you doing anything.
Improvements to property work differently. Money you spend on a rental property or a home generally is not added to basis, so those costs are not recovered through the gain calculation.
Wash sale adjustments can reduce what you claim. If you sold at a loss and bought a substantially identical security within 30 days before or after, the loss is deferred and added to the basis of the replacement shares.
Step 2: Classify the Gain as Short-Term or Long-Term
Hold an asset one year or less and the gain is short-term, taxed at ordinary income rates. Hold it more than one year and it is long-term, taxed at preferential rates. The day count starts the day after you acquire the asset and includes the day you dispose of it, which is the detail that catches people who sell a day early.
| Example | Held | Gain | Classification |
|---|---|---|---|
| Bought a stock, sold it 40 days later | 40 days | $900 | Short-term |
| Bought a stock, sold it exactly 12 months later | 12 months | $900 | Short-term |
| Bought a stock, sold it one day past 12 months | 12 months + 1 day | $900 | Long-term |
| Bought an ETF, sold it 3 years later | 3 years | $900 | Long-term |
| Bought crypto, sold it 2 years later | 2 years | $900 | Long-term |
When you own a position through a dividend reinvestment or a stock split, you still use the original purchase date. Do not restart the clock.
Step 3: Apply the Applicable Federal Rate
Short-term gains sit on top of your ordinary income: wages, interest, rent. A $15,000 short-term gain behaves exactly like a $15,000 raise, which can push every other dollar of your income into a higher bracket. Members of Bogleheads describe this as stacking, and they are describing it correctly.
Long-term gains are also stacked on your income, but the whole gain is then taxed at the preferential long-term rate, not the ordinary bracket rate.
| Taxable income level | Long-term rate | Who it hits |
|---|---|---|
| Below the indexed 0% ceiling | 0% | Most investors with modest income |
| Above the 0% ceiling, below the indexed 20% threshold | 15% | Middle to upper-middle income |
| Above the indexed 20% threshold | 20% | High earners and large realized gains |
The 0%, 15% and 20% thresholds are set by filing status and are adjusted for inflation every year. The breakpoints published for a recent filing season were $96,700 of taxable income for a single filer and $193,550 for married filing jointly, with head of household at $103,350 and married filing separately at $48,350. Look up the 2026 thresholds in the current IRS revenue procedure before you rely on them, because the number that matters to you is the one for the year you are filing.
Ordinary income rates for short-term gains have stayed in a 10% to 37% band. A gain can also trigger the Net Investment Income Tax, a 3.8% surtax that applies once modified adjusted gross income passes $200,000 for a single filer or $250,000 married filing jointly, adding to investment income rather than replacing it. Add it up and the worst case for a long-term gain is 23.8% federal before state tax.
Short-Term vs. Long-Term Capital Gains: Key Differences
The split between short-term and long-term is the single largest factor in what you pay. Everything else on this page is detail hanging off that line.
| Factor | Short-term | Long-term |
|---|---|---|
| Holding period | One year or less | More than one year |
| Federal rate | 10% to 37% ordinary income | 0%, 15% or 20% |
| NIIT applies | Yes | Yes |
| Bracket effect | Raises the rate on your other income | Stacks on income, but at the preferential rate |
| Typical scenario | Day trading, quick flips, active rebalancing | Index fund investing, retirement withdrawals, home sales |
| Form 8949 code | C or F | D or E |
Look at a single $40,000 gain to see the gap. Short-term, on top of $70,000 of other income, it lands in the 22% bracket and costs about $8,800. The same $40,000 held more than a year and realized by a single filer in the 15% band costs about $6,000. The holding period, not the profit, created the difference.
What Happens When You Sell Different Investments?
Stocks and ETFs follow the straightforward path: proceeds minus adjusted basis, then the holding period split. Fractional shares work the same way. Buy half a share for $100, see it worth $210, sell for $210, and your taxable gain is $110. The fractional share is not special treatment.
Mutual funds add one wrinkle. Even if you never sell, a fund that realized gains internally can distribute them to you at year end. That capital gains distribution is taxed to you in the year it is paid, whether or not you reinvested it. Tax-efficient index funds exist largely to keep this from happening.
Bonds sold before maturity can produce a gain or a loss depending on where rates moved since you bought them. Interest from a bond is ordinary income, the principal difference is capital gain or loss, and you hold the pieces separately for the holding period count.
Cryptocurrency is treated as property, not currency, for federal tax purposes. Every swap counts: trading one coin for another is a disposal of the first coin and an acquisition of the second, each with its own basis and its own gain or loss. Selling for dollars is another. There is no holding period exemption for long-held coins, and brokers may report incomplete cost basis, so many people calculate it themselves from exchange records.
Managed accounts and college 529 plans follow the account’s own rules rather than the standard treatment, so read the specific program rules before selling inside them.
Inside a Roth IRA or a 401(k), selling an investment creates no current-year capital gains tax because the account itself is not taxed. Withdrawals from a Roth IRA are generally tax-free if you meet the qualified distribution rules. Withdrawals from a traditional IRA and 401(k) are taxed as ordinary income, not capital gain, which is the detail that surprises IRA holders expecting a capital gains rate.
| Account type | Tax on a sale inside the account | Tax when you withdraw |
|---|---|---|
| Taxable brokerage | Yes, immediately on realized gains | None beyond the gain already taxed |
| Roth IRA | No current-year tax | Generally none if qualified |
| Traditional IRA | No current-year tax | Ordinary income, no capital gains rate |
| 401(k) or 403(b) | No current-year tax | Ordinary income on the amount withdrawn |
| HSA | No current-year tax | Ordinary income, tax-free if 65 or older |
Exceptions exist inside these accounts. Buying and selling mutual funds inside an IRA can still trigger a capital gains distribution from the fund, which the IRA owes tax on annually whether or not you touch it.
How the IRS Calculates the Tax You Owe
The chain runs: total capital gains, minus total capital losses, equals net capital gain. That net amount lands on top of your other income to produce taxable income. The tax on the long-term portion is computed separately at the preferential rates and added to the ordinary income tax.
The final figure on your return rarely matches the multiplication you did in your head. Taxable income is not the same as your take-home pay or even your gross income. It reflects deductions you are entitled to, such as the standard deduction or itemized deductions, plus any taxable portions of Social Security, and it adjusts for credits like the child tax credit or education credits.
Payments made during the year change what you still owe. Federal withholding from your paycheck, estimated tax payments, and any refundable credits all reduce the balance due. If it looks wrong, the arithmetic is probably fine and the input lines are not.
On a $100,000 long-term gain, the tax ranges from nothing to $20,000 depending entirely on which bracket your total income lands in. The gain size does not pick the rate; your income does.
Can Capital Losses Reduce Your Tax Bill?
Yes, within limits. Short-term losses net against short-term gains first, and long-term losses net against long-term gains first. Only after that netting do the two sides combine, and the character of the remaining net gain determines whether it is taxed at preferential or ordinary rates.
If your losses exceed your gains, the difference offsets ordinary income up to $3,000 in that year. The rest carries forward as a capital loss and offsets capital gains in future years, with no expiration date, until it is used. Investors who inherit unused carryforwards leave potentially valuable deductions behind, so it is worth checking whether a prior year return was filed correctly.
The wash sale rule is what stops the strategy from being unlimited. If you sell a security at a loss and acquire a substantially identical one within 30 days before or after the sale, the loss is disallowed on that sale and added to the cost basis of the replacement. The same rule reaches into your IRA, which is the part that catches automated investors by surprise.
This bites hardest with a monthly ETF purchase plan, where new shares keep landing inside the wash window. Questions on Money StackExchange about whether selling every share removes the problem come up because the answer is not intuitive: the replacement purchase is what disallows the loss, and buying the identical fund the next month re-creates it.
Harvesting also has an offsetting cost. Realizing a loss in a taxable account can create a larger gain later when you buy back, because the higher basis is taxed at that future sale. You have moved the tax, not removed it.
When Do You Owe Capital Gains Tax?
You owe tax when you realize a gain, and realization is narrower than it looks. An unrealized gain is a paper number on a statement that changes daily and is not taxed. No generally applicable federal tax is due simply because your portfolio went up.
Common realization triggers include selling any part of a position, exchanging one investment for another, a mutual fund or ETF paying a capital gains distribution, and in some cases receiving appreciated property as a gift or through a conversion.
That distinction explains the most common complaint from forum readers: why do I owe taxes on investments I did not sell. Two mechanisms cause it. A capital gains distribution is the fund selling investments inside itself and passing the profit to every shareholder, and your reinvested dividends bought more shares, which is a purchase. Neither is optional once the fund has done it.
Receiving a 1099-B with a gain you never recognized usually means an internal fund sale, a distribution, or a transfer with a basis your broker cannot verify. Those are the entries to check first when the numbers look unfamiliar.
How Investors Report Capital Gains and Losses
Your broker sends Form 1099-B for sales in a taxable account, listing proceeds, cost basis, dates and whether the transaction was reported as short-term or long-term. It arrives in late January, and a corrected version can follow later.
For most people, Form 8949 is the bridge. You copy the 1099-B entries that need adjustment onto the form, and the totals flow to Schedule D. Schedule D nets your short-term and long-term results and reports either the net gain or the loss to carry forward.
Schedule D feeds the capital gains line on Form 1040. That one number joins your wages, interest, dividends and other income, and the tax on it is computed using the preferential rate schedule for the long-term portion.
Some entries genuinely require adjustment, and several require none. Noncovered securities such as most mutual funds, many bonds, crypto and any position bought before the broker’s records begin may show a missing or wrong basis. Selling inherited shares needs a cost-basis election to use the stepped-up value. Gain or loss on property you held for personal use, such as a car or your own home, is not reported at all.
Noncovered transactions get lumped into box C or box D on Form 8949, which can be more conservative than necessary once you work out each basis by hand.
Ways Investors Can Manage Capital Gains Tax
Nothing here is individualized advice, and the order of operations matters more than any single trick. Where money is involved, run the plan past a qualified tax professional, particularly before a large sale.
1. Hold past the one-year mark. This is the most valuable move available and it costs nothing but patience. Selling one day short of twelve months converts a long-term gain into an ordinary income gain, which on a $30,000 gain can cost more than $2,000 in extra federal tax.
2. Use tax-advantaged accounts. Roth IRA contributions, 401(k) deferrals and HSA contributions move money away from taxable accounts entirely, subject to income and plan limits. Remember that traditional account withdrawals come back as ordinary income rather than at preferential capital gains rates.
3. Rebalance with new money first. Directing dividends into the underweight positions of a portfolio avoids selling anything, so there is no realized gain to report. The side effect is that the account drifts toward being all cash until dividends catch up.
4. Harvest losses carefully. Sell positions sitting at a loss, check every linked account including IRAs and any 401(k) for purchases inside the 30-day wash window, then rebuy after the window closes. Keep records of what disallows, because the deferral increases your future basis.
5. Time larger sales. Selling in a year with lower income, or in the gap between jobs or before retirement, can push a long-term gain into the 0% bracket. The same reasoning supports staggering a large gain across two tax years.
6. Donate appreciated shares held more than a year. Donating to a qualified charity generally avoids the capital gains tax entirely, and you can deduct fair market value against your income tax. The shares must be held long-term to get the deduction, and the rules differ for appreciated property in a private foundation.
7. Plan for estimated payments. A big sale can leave you owing tax that was never withheld. Publication 505 covers the details, and Form 4868 is the request for an extension to pay, though an extension to file is not an extension to pay.
8. Check state treatment. Most states tax capital gains as ordinary income at their own rates, several align with federal rates, and a handful tax no capital gains at all. Your state can move the final number more than most people expect.
Frequently Asked Questions
Do I owe capital gains tax if my investments went up but I did not sell them?
No. Federal capital gains tax is due on realized gains, and a rising portfolio balance is an unrealized gain that the IRS does not tax. You owe tax when you sell or exchange, and sometimes when a fund distributes its own gains to you. Dividends and interest are still taxed every year whether or not you sold anything, which is why a tax bill can arrive without a single trade.
How long do I have to hold an investment for long-term capital gains tax rates?
More than one year. Counting starts the day after you buy and includes the day you sell, so a position sold exactly twelve months after purchase is short-term, and one sold on day 12 months and one day is long-term. Many investors miscount by one day and give up the preferential rate for nothing. Long-term gains are taxed at 0%, 15% or 20% depending on total taxable income and filing status.
What counts as the cost basis when I buy stocks, ETFs, or mutual funds?
Your basis is what you paid to acquire the shares, plus commissions and fees you paid to buy or sell them. For mutual funds and some ETFs, reinvested distributions are added to basis over the years. If you bought across several purchases, the basis is the total cost of all shares, so the gain per share differs from your average purchase price. A broker must show basis on a 1099-B, but noncovered securities often require you to supply it yourself.
Can I deduct a capital loss if I did not sell the losing investment?
No. A loss becomes deductible only when it is realized, which means you sold the investment or exchanged it. An unrealized loss sitting in your account is not deductible, which is why a falling portfolio does not reduce your current tax bill. Once realized, short-term losses net against short-term gains and long-term against long-term, with up to $3,000 offsetting ordinary income and the remainder carried forward indefinitely.
Does a capital gains tax apply to dividends and interest?
Dividends and interest are not capital gains, but they are still taxable. Qualified dividends from U.S. companies are taxed at the same 0%, 15% or 20% preferential rates as long-term capital gains, regardless of how long you held the stock before the dividend was paid. Interest, including interest from money market funds, savings accounts and bond payments, is taxed as ordinary income at your marginal rate. The distinction is in how each item is reported and taxed, not whether it is taxed.
Do capital gains taxes apply to cryptocurrency transactions?
Yes. The IRS treats cryptocurrency as property, so a sale to dollars or a trade of one coin for another is a taxable disposal of the first asset. Each transaction has its own cost basis, gain or loss, and holding period. Because coins are property, the one-year long-term rule applies just as it does to stocks. Exchanges frequently report incomplete or inaccurate cost basis, so many holders rebuild the numbers from their own trade history.
Conclusion: What to Do First
The whole system rests on one sentence: you pay tax on profit, not on the full sale price, and only once you realize it. Get the proceeds from your statement, subtract your adjusted cost basis, and check whether you crossed the one-year line.
If the gain is short-term, you already know the rate range, 10% to 37%, and that it sits on top of your other income. If it is long-term, your taxable income decides between 0%, 15% and 20%, and that number may be worth delaying a sale by a few weeks.
Before a large trade or sale, run the figures through a qualified tax professional who can check your bracket position, your account type and your state. This page is general educational information about how capital gains tax works on investments, not individualized advice, and the rules and thresholds change.


