Is Capital Gains Rate Based on AGI or Taxable Income?

Is capital gains rate based on AGI or taxable income? I asked that after I sold some stock and saw a tax number I did not expect. I had assumed my adjusted gross income, or AGI, was the test. I was wrong, and the difference changed my tax bill.

The short version is that the 0%, 15%, and 20% rates use taxable income. But AGI still matters in other ways. In this guide, I will show you both sides with 2027 numbers and simple examples. You will also see the mistakes that trip people up most.

Is Capital Gains Rate Based on AGI or Taxable Income? The Short Answer

Your long-term capital gains rate depends on taxable income. It does not depend on AGI. Taxable income is what is left after you subtract the standard deduction or your itemized deductions.

AGI still plays a role in other rules. The 3.8% net investment income tax uses a version of AGI. So do several credits and phaseouts. I will cover each one below.

The IRS published the 2027 rate thresholds in Revenue Procedure 2026-35. They apply to returns you file in 2028. The rates stay at 0%, 15%, and 20%. Only the income lines moved.

Here is the part most people miss. Your gain counts as part of your taxable income. It sits on top of your other income, and that stacking decides which rate you pay.

As an Amazon Associate I earn from qualifying purchases.

AGI vs. Taxable Income: The Quick Version

These two numbers sound alike, and that is why people mix them up. They are different checkpoints on the same road.

AGI is your total income minus a short list of adjustments. Taxable income is AGI minus your deductions. Say your AGI is $80,000 and you take the 2027 single standard deduction of $16,600. Your taxable income is $63,400.

That $16,600 gap is the whole reason the two numbers differ. The capital gains thresholds look at the smaller number. That is good news for you.

Is Capital Gains Rate Based on AGI or Taxable Income in the 2027 Brackets?

The IRS writes the brackets in terms of taxable income. Here are the 2027 long-term capital gains lines for the main filing statuses.

Filing Status0% Rate Up To15% Rate Up To
Single$51,050$563,200
Married filing jointly$102,100$633,600
Head of household$68,350$598,400

Anything above the 15% line pays 20%. Married filing separately has its own lower lines, so check Rev. Proc. 2026-35 if that is you. Estates and trusts use much lower numbers too.

Compare that with wages. Ordinary income faces rates from 10% to 37%. That gap is why long-term gains are such a big deal for investors.

What Counts as Taxable Income for the Rate?

The test counts your ordinary taxable income plus your gains. Qualified dividends count too, since they use the same rates. Tax pros call the gain part “adjusted net capital gain.”

You do not need to memorize that term. Just remember that all of your income after deductions gets measured against the lines above.

Why Is Capital Gains Rate Based on AGI or Taxable Income? The Stacking Idea

The tax code fills your income in layers. Ordinary income goes in first. Then your long-term gains stack on top. Each slice of gain gets the rate for the spot where it lands.

That means one gain can face two rates. I did not know this at first. I thought a big sale pushed everything into one rate.

A Worked Example With the 0% Rate

Let me show you with numbers. This is an example I built for teaching. It is not a real return.

A single filer earns $46,600 in wages. After the $16,600 standard deduction, ordinary taxable income is $30,000. The filer also sells stock held over a year for a $40,000 gain. Total taxable income is $70,000.

Slice of IncomeAmountRate
Ordinary income$30,00010% and 12%
Gain below the $51,050 line$21,0500%
Gain above the $51,050 line$18,95015%

The first $21,050 of the gain fills the space between $30,000 and $51,050. That part pays nothing. The last $18,950 pays 15%, which is about $2,843.

Now picture the trap. This filer’s AGI is $86,600. If the rate used AGI, the whole gain would face 15%. That would cost $6,000. The stacking rule saves about $3,158.

The ordinary tax is a separate bill. It comes to about $3,344 under the 2027 single brackets. I did this math by hand, so treat it as an estimate.

The Standard Deduction Can Shelter Gains Too

Deductions do not only help wages. If your ordinary income is too small to use the whole standard deduction, the leftover can reduce your gain.

Take a single filer with $10,000 in wages and a $20,000 long-term gain. Income totals $30,000. Subtract $16,600 and taxable income is $13,400. All of it falls under the 0% line, so the federal tax is zero.

I love this one. It shows why taxable income, not AGI, is the right test. The deduction really does the work.

A Married Couple Example

The same stacking works for joint filers, only the 0% line is bigger. Take a couple with $85,000 of ordinary taxable income and a $30,000 long-term gain.

The 2027 joint 0% line is $102,100. That leaves $17,100 of room, so the first $17,100 of the gain pays 0%. The last $12,900 pays 15%, which is $1,935. Without the stacking rule, I would have guessed a much bigger number.

Can a Big Gain Push My Ordinary Income Into a Higher Bracket?

No, and this surprised me. The tax code figures the tax on your ordinary income first, as if the gain did not exist. Then it adds the tax on the gain using the special rates.

So a large sale does not bump your wages into the 24% bracket. It only decides which capital gains rate each slice of the gain gets. That is a big relief for anyone who fears one sale will wreck the whole return.

The gain still raises your total taxable income. That is what moves part of it from the 0% layer to the 15% layer. The effect stays inside the gain.

Is Capital Gains Rate Based on AGI or Taxable Income for the 3.8% NIIT?

For the net investment income tax, the answer flips. The NIIT looks at modified adjusted gross income, or MAGI. For most people, MAGI is the same as AGI.

The NIIT adds 3.8% on investment income when MAGI passes a line. The lines are $200,000 for single filers, $250,000 for joint filers, and $125,000 for married filing separately. These amounts come from the statute. They do not move with inflation, so they are the same in 2027.

The tax hits the lesser of two numbers. One is your net investment income. The other is how far your MAGI is above the line. Interest, dividends, rental income, and gains all count as investment income.

An NIIT Example Side by Side

Say a single filer has $190,000 in wages and a $50,000 long-term gain. AGI is $240,000 with no adjustments. Taxable income is $223,400 after the standard deduction.

ItemAmountWhat It Decides
Taxable income$223,400Gain taxed at 15%, or $7,500
MAGI over the $200,000 line$40,000Amount exposed to NIIT
NIIT at 3.8%$1,520Extra tax on that $40,000

One gain, two different tests. Taxable income set the 15% rate. MAGI set the extra 3.8%. Together, the gain costs about 18%, not 15%.

You report the NIIT on Form 8960. Tax software handles it for you, but you should know why that extra line appears.

Where AGI Still Matters Even Though Gains Use Taxable Income

A gain raises your AGI the moment you sell. That can ripple into rules that have nothing to do with the capital gains rate. This is the part nobody warned me about.

Once you know the answer to “is capital gains rate based on agi or taxable income,” the next question is what else the gain touches. The table below shows common rules and what each one measures. Check each program’s current rules before you plan around them.

RuleWhat It Looks AtWhy a Gain Matters
Roth IRA eligibilityMAGIA big gain can shrink your limit
Medicare IRMAA surchargeMAGI from two years backA gain now can raise premiums later
Medical deduction floorAGIThe 7.5% floor rises with your AGI
Social Security taxationCombined income, which starts from AGIA gain can make more benefits taxable
3.8% NIITMAGIExtra tax above the statute lines

Health insurance credits on the marketplace also depend on household income. The exact formula varies by year and by plan rules.

So here is how I think about it. The gain rate comes from taxable income. The side effects come from AGI. You need to check both before you sell something big.

Why Does Cost Basis Change Everything Before the Rate Even Matters?

The rate only applies to your gain. And your gain is the sale price minus your cost basis. A wrong basis means a wrong gain.

Basis is usually what you paid, plus fees. Reinvested dividends add to it. I once forgot about years of reinvested dividends. My gain looked much bigger than it really was.

Brokers report basis on most newer purchases. Older shares, gifts, and inherited assets can be trickier. Check the number before you worry about the rate.

Short-Term, Long-Term, and Special Gains: Which Rate Applies?

Not every gain gets the 0%, 15%, or 20% rate. The holding period and the type of asset matter. Hold an asset for more than one year, and the long-term rates can apply.

Type of GainFederal RateKey Detail
Short-term gain10% to 37%Held one year or less
Long-term gain0%, 15%, or 20%Held over one year
Qualified dividends0%, 15%, or 20%Same lines as long-term gains
CollectiblesUp to 28%Art, coins, and similar items
Unrecaptured section 1250 gainUp to 25%Depreciation on real estate

A short-term gain faces wage-like rates. It lands in your ordinary brackets. That is why I now look at the calendar before I sell anything.

The special rates are rarer. If you sell a coin collection or a rental property, ask a pro how they apply. Those rules have extra steps.

Is Capital Gains Rate Based on AGI or Taxable Income? Mistakes I Made

I got a lot of this wrong at the start. Most of my errors came from using the wrong number for the wrong test. This table covers the ones I see again and again.

MistakeBetter Approach
Comparing AGI to the 0% lineUse taxable income instead
Thinking the gain gets one flat rateRemember the gain stacks in layers
Forgetting that the gain counts in the testAdd the gain before you check the line
Ignoring the NIITCompare MAGI to the statute line
Selling at 11 monthsWait for more than one year
Assuming my state follows federal rulesRead your state’s rules

The 11-month mistake cost me real money once. A short-term gain pays wage-like rates. Waiting a few extra weeks would have changed the rate.

State rules vary a lot. Some states tax gains like ordinary income. Others have no income tax at all. Check yours before you sell.

Is Capital Gains Rate Based on AGI or Taxable Income on Form 1040 and Schedule D?

You can see both numbers on your return. Each sale goes on Form 8949 and flows to Schedule D. Form 1040 then shows your AGI first and your taxable income a few lines later. Line numbers change by year, so look for the labels.

The tax itself comes from a worksheet that stacks your gains on top of your ordinary income. Tax software runs it quietly. You never have to pick the rate yourself.

If you prepare your own return, read the worksheet once. It shows the stacking idea in plain steps. It was the first place the logic really clicked for me.

Do Qualified Dividends Follow the Same Rule?

Yes. Qualified dividends use the same 0%, 15%, and 20% lines as long-term gains. They also stack on top of your ordinary income. Your Form 1099-DIV shows which dividends qualify.

Ordinary dividends are different. They face ordinary rates, like wages. You usually need to hold the stock for a minimum period around the dividend date for it to count as qualified. Check your broker’s form before you assume.

Dividends also feed the NIIT. They count as investment income there too. So a stock that pays you every quarter can matter even if you never sell it.

Is Capital Gains Rate Based on AGI or Taxable Income After Capital Losses?

Your losses come off before the rate is set. Capital losses first cancel out capital gains. Then up to $3,000 of extra loss can reduce other income each year. Anything left carries forward to later years.

That lowers both AGI and taxable income. So a loss in the same year can pull a gain down into a cheaper layer. Some people sell losers on purpose for this reason.

Watch out for the wash sale rule. If you buy the same investment within 30 days before or after the sale, the IRS blocks the loss for now. I learned that one the hard way after a quick repurchase.

Is Capital Gains Rate Based on AGI or Taxable Income When You Sell Your Home?

Home sales have a special break. If you qualify, you can exclude up to $250,000 of gain, or $500,000 for joint filers. You generally must have owned and lived in the home for two of the last five years.

Excluded gain never reaches your AGI or your taxable income. It is as if it never happened. That makes the rate question moot for that part.

Any gain above the exclusion is a normal long-term gain. It stacks on top of your other income like any other sale. Those exclusion amounts are set by law and do not move with inflation.

Is Capital Gains Rate Based on AGI or Taxable Income for Retirees With IRA Withdrawals?

Retirement withdrawals are a big deal here. Withdrawals from a traditional IRA or 401(k) count as ordinary income. They fill the bottom layers first. Your gains then stack above them.

Picture a single retiree who takes $35,000 from an IRA. After the $16,600 standard deduction, ordinary taxable income is $18,400. That leaves $32,650 of room under the 2027 0% line for gains.

Now add a $20,000 Roth conversion. A conversion counts as ordinary income too. It would use up $20,000 of that room and push more gains into the 15% layer. Timing matters a lot in retirement.

Is Capital Gains Rate Based on AGI or Taxable Income? Myths I Believed

A few wrong ideas stuck with me for years. Here are the three biggest.

Myth: one big sale means the 20% rate on the whole gain. In real life, only the slice above the 15% line pays 20%. For a single filer in 2027, that line is $563,200 of taxable income.

Myth: gains under the 0% line are always tax-free. They are not. The 0% line applies to total taxable income, so your wages use up room first. And state tax, the NIIT, and AGI-based rules can still apply.

Myth: the AGI on page one of Form 1040 sets my gain rate. It does not. Taxable income does, and that number comes later on the form.

Does Itemizing or the Standard Deduction Change My Gain Rate?

Yes, indirectly. Bigger deductions mean lower taxable income. Lower taxable income leaves more room under the 0% and 15% lines.

Most people take the standard deduction. In 2027, that is $16,600 for single filers and $33,200 for joint filers. Itemizing only helps if your list beats those amounts.

Gifts to charity are one itemized item with a twist. Giving appreciated stock you held over a year can avoid the gain on it, and you may deduct the value. The rules have limits, so ask a pro before you try it.

How the 0% Rate Can Shape Your Plans

Once you know the answer to “is capital gains rate based on agi or taxable income,” the 0% bracket becomes a planning tool. Kiplinger suggests that people with income that swings from year to year can sell winners in low-income years. That way, more of the gain lands under the 0% line.

This works well for people between jobs, early retirees, or anyone with a quiet income year. It can also work if big deductions pull taxable income down.

Remember that the gain itself fills the 0% space. Selling too much can push part of it into 15%. In the earlier example, the filer had $21,050 of room. Anything past that paid 15%.

Also keep the AGI side effects in mind. A gain that stays at 0% federal can still raise AGI. That can touch credits, Roth limits, or Medicare premiums. I am not your tax preparer, so run the numbers with a pro before a big sale.

Some newer deductions can lower taxable income too. The 2025 tax law added deductions for qualified tips, qualified overtime, and older adults. Reports say they end after tax year 2028 unless Congress extends them. Read each rule before you count on one.

How Do You Check Your Own Capital Gains Rate in Five Minutes?

You can do this with last year’s return or a draft return. So, is capital gains rate based on AGI or taxable income for you? These steps show it with your own numbers.

  1. Find your taxable income on Form 1040.
  2. Subtract your long-term gains and qualified dividends. What is left is your ordinary taxable income.
  3. Compare that number to the 0% line for your filing status.
  4. Fill the room left under the 0% line first. Tax the next slice at 15% up to the 15% line.
  5. Anything above the 15% line gets 20%.
  6. Last, compare your MAGI to the NIIT line for your filing status.

Tax software and the capital gains worksheet in the Form 1040 instructions do these steps for you. Still, running them once by hand taught me more than any article. If your answer differs from the software, look for a missed item.

Final Thoughts

My biggest lesson is simple. So, is capital gains rate based on AGI or taxable income? Taxable income, not AGI. Your gain stacks on top of your other income, and each slice gets its own rate. AGI still matters for the NIIT and for rules like Roth limits and Medicare premiums.

My honest advice is to check both numbers before you sell. Expect the rates to stay the same and the lines to drift up with inflation. The 2027 figures could change if Congress acts, so confirm them with the IRS. If a sale is big, a quick call with a tax pro is cheap insurance.

Scroll to Top