No, medical expenses cannot directly offset capital gains. Only a capital loss cancels a gain on the same tax form, but a large medical deduction can lower your taxable income, and that can indirectly cut the tax you owe on the gain.
The conflict comes from 26 U.S. Code § 213, which for 2026 and 2027 sets a floor for the medical deduction at 7.5% of adjusted gross income (AGI).
Your gain counts as income, so it raises your AGI, and a higher AGI raises the floor. The profit you hoped to shelter ends up weakening the tax break itself.
That is a hard result for anyone who sold investments in a bad health year. Many people hope to see their itemized deductions offset capital gains, and medical bills are the deduction they count on most.
A second hurdle stands in the way as well. The standard deduction is large, and Public Law 119-21 made the larger amount permanent.
Most filers take it, so many people with big medical bills get no federal tax benefit from them at all.
The Two Worlds of Your Tax Return: Schedule D vs. Schedule A
Your tax return is like a puzzle with many pieces, and two of the biggest are Schedule D and Schedule A. They handle different parts of your financial life and never touch each other directly.
A capital gain is the profit you make when you sell something for more than you paid.
The asset is usually an investment, such as stocks, bonds or real estate, and the sale is reported on Schedule D, Capital Gains and Losses. Most stock sales are listed first on Form 8949, which feeds Schedule D.
Your purchase price and selling costs are the expenses deducted from capital gains on those forms. Medical bills are not on that list, so they never reduce the gain itself.
A medical expense deduction is a tax break for money you spent on health care.
It is an itemized deduction, one of a list of specific costs you can subtract from income, and all of them go on a different form, Schedule A, Itemized Deductions.
That separation is why you cannot subtract a medical bill from a stock profit on Schedule D.
The two numbers meet only later, when both forms flow onto your main Form 1040 and your taxable income is figured. Whether you should deduct medical expenses at all depends on what happens at that later step.
The Catch-22: How Your Capital Gain Sabotages Your Medical Deduction
Before you can deduct a dollar of medical costs, you have to clear the AGI floor enforced by the Internal Revenue Service (IRS). This one rule is the main reason the strategy so often fails.
AGI is your total income for the year, including wages, interest and your capital gains, minus a few adjustments such as student loan interest or health savings account contributions. It is figured before most of your big deductions, which means a medical bill cannot shrink it.
The law lets you deduct only the unreimbursed medical expenses that are more than 7.5% of your AGI. With an AGI of $100,000, the floor is $7,500. If you paid $10,000 in medical bills, the first part is ignored and only $2,500 can be deducted.
Now add a $50,000 capital gain from selling stock. Your AGI rises to $150,000 and the floor rises to $11,250, which is $3,750 more of your bills that no longer counts. The same $10,000 of bills now produces no deduction at all.
Real estate works the same way. Any taxable profit from selling a home for care lands in AGI and lifts the floor just as a stock sale does.
The floor is also permanent. Congress left it unchanged in its latest tax law, so no lower threshold is coming for 2026 or 2027.
A common case shows how hard the floor is to clear. Someone with a $27,000 gain and $900 of medical costs often hopes the bills will trim the tax. With a normal paycheck on top, those bills sit far below the floor and change nothing.
The Indirect Connection: How a "Bracket Drop" Can Lower Your Capital Gains Tax
Medical expenses can still lower the tax on a gain through a longer route. The whole effect depends on one number on your return, your taxable income.
Your return follows a set path. You add up gross income, which is all the money that came in, and subtract adjustments to get AGI.
Then you subtract either the standard deduction or your itemized deductions, including medical costs, to reach taxable income.
Taxable income sets the rate on long-term capital gains, the profits on assets held more than one year. For 2026 and 2027, those rates are 0%, 15%, or 20%, and the rate you pay depends on how high your income reaches.
Long-term gains are stacked on top of your ordinary taxable income, such as wages and pensions. A deduction comes off the ordinary income first, which pushes the whole stack down.
The gain itself gets a lower rate only when the stack crosses a breakpoint and part of the gain slips into the band below.
That crossing is the "bracket drop." If your stack sits well inside the middle rate band, a medical deduction saves tax on your ordinary income and nothing on the gain.
Short-term gains work differently, because profit on an asset held one year or less is taxed as ordinary income. A medical deduction then saves your regular marginal rate on those dollars, with no bracket drop needed.
Where the breakpoints sit depends on your filing status. The 2027 breakpoints for a married couple filing jointly are $102,100 and $633,600 of taxable income.
2026 and 2027 Long-Term Capital Gains Rate Thresholds (Taxable Income)
The first two columns of figures come from Rev. Proc. 2025-32 and the last two from Rev. Proc. 2026-35. Each cap is the highest taxable income taxed at that rate, and the 20% rate applies to any gain above the 15% cap.
| Filing Status | 2026 0% Cap | 2026 15% Cap | 2027 0% Cap | 2027 15% Cap |
|---|---|---|---|---|
| Married filing jointly | $98,900 | $613,700 | $102,100 | $633,600 |
| Single | $49,450 | $545,500 | $51,050 | $563,200 |
| Head of household | $66,200 | $579,600 | $68,350 | $598,400 |
| Married filing separately | $49,450 | $306,850 | $51,050 | $316,800 |
What a Medical Deduction Cannot Lower: NIIT and Other AGI-Based Costs
Some costs tied to a gain are figured before itemized deductions ever enter the math. A medical deduction cannot touch them, no matter how large it is.
The biggest is the net investment income tax (NIIT), an extra 3.8% on investment income. It applies when modified adjusted gross income (MAGI) is above $200,000 for single filers or $250,000 for married couples filing jointly.
Those thresholds are not indexed for inflation, so they are the same for 2026 and 2027.
Itemized deductions come after AGI, so they do not reduce MAGI. A medical deduction therefore never lowers the NIIT, even in a year of very large bills.
Two other costs follow the same pattern. Medicare premium surcharges, the income-related monthly adjustment amounts (IRMAA), are based on MAGI, and so is the share of your Social Security benefits that gets taxed.
A large gain can raise all three. Your medical bills lower none of them, which surprises many high-income sellers who assumed the deduction would cut every tax on the gain.
The Big Choice: Taking the Easy Money or Doing the Math
Before the AGI floor even matters, you face a bigger choice: take the standard deduction or itemize. You cannot do both, and for most people this choice makes the medical deduction irrelevant.
The standard deduction is a fixed amount you subtract from income with no receipts required.
The 2026 standard deduction is $16,100 for single filers, $32,200 for married couples filing jointly and $24,150 for heads of household. The 2027 standard deduction is $16,600, $33,200 and $24,925.
Itemizing means adding up your actual deductible costs for the year. The list includes state and local taxes (SALT), mortgage interest, gifts to charity and your qualifying medical expenses.
The SALT deduction is capped at $40,400 for 2026 and $40,804 for 2027, or $20,200 and $20,402 for married people filing separately.
The cap shrinks by 30% of MAGI above $505,000 for 2026 and $510,050 for 2027, but it never falls below $10,000. The Schedule A instructions explain how that limit is applied.
Itemize only when your total is more than the standard deduction for your filing status. Even then, your real benefit is only the amount above the standard deduction, because you give that up to itemize.
The standard deduction amounts for both tax years are in this table. It also lists the extra amounts for older and blind filers.
| Filing Status | 2026 Deduction | 2027 Deduction |
|---|---|---|
| Single or married filing separately | $16,100 | $16,600 |
| Married filing jointly | $32,200 | $33,200 |
| Head of household | $24,150 | $24,925 |
| Extra amount if 65 or older or blind, married (per person) | $1,650 | $1,700 |
| Extra amount if 65 or older or blind, unmarried | $2,050 | $2,100 |
Recent Law Changes That Affect Whether You Should Itemize
Three rules that took effect during 2025 and 2026 change the itemizing math. Each one can move the answer for a filer with large medical bills.
The first is the higher SALT cap, which reached $40,400 on 2026 returns. Homeowners in high-tax states now clear the standard deduction more easily, and once they do, every deductible medical dollar counts.
The second is the $6,000 senior deduction for each person age 65 or older, available for tax years 2025 through 2028.
You claim it whether you itemize or take the standard deduction. It phases out at 6% of MAGI above $75,000, or $150,000 for joint filers.
The senior deduction lowers taxable income, not AGI. It does nothing to the medical floor, but it can pull part of a gain into the lowest capital gains band on its own.
Retirees who ask how capital gains after 65 are taxed often find this deduction matters more than their medical bills.
The third rule applies from 2026 to filers in the top bracket. A new limit trims the value of their itemized deductions by 2/37, so each affected dollar saves about 35 cents instead of 37.
The 2027 37% bracket starts above $661,375 of taxable income for single filers and $793,650 for joint filers. Below those amounts, the new limit does not apply and a medical deduction keeps its full value.
With those changes in mind, the two deduction choices compare this way.
| Feature | Standard Deduction | Itemized Deductions |
|---|---|---|
| What it is | A fixed amount set by the IRS for your filing status, with no records needed. | A list of eligible expenses you add up, including medical costs, state taxes and mortgage interest. |
| Who should use it | Anyone whose itemized total is less than the standard deduction. This is most taxpayers. | Only those whose itemized total is more than their standard deduction. |
Real-World Scenarios: See How the Numbers Actually Work
These examples use the official 2027 figures from Rev. Proc. 2026-35. The same steps work on a 2026 return with that year's slightly lower amounts.
Scenario 1: The Retiree's Stock Windfall
A married couple files jointly. Both are 62, so they are too young for the extra deductions for people 65 and older. They have $60,000 of pension income and sell a long-held stock for a $90,000 long-term capital gain, which brings their AGI to $150,000.
One spouse has a major illness that leaves $40,000 of unreimbursed medical bills. The couple also pays $10,000 in state and property taxes during the year.
| 2027 Step | Result |
|---|---|
| AGI | $60,000 pension + $90,000 gain = $150,000 |
| AGI floor | 7.5% of $150,000 = $11,250, so the first $11,250 of bills is not deductible |
| Medical deduction | $40,000 – $11,250 = $28,750 |
| Total itemized deductions | $28,750 + $10,000 of taxes = $38,750, more than the $33,200 standard deduction |
| Taxable income | $111,250 itemizing, compared with $116,800 using the standard deduction |
| Gain taxed at 0% | $80,850 itemizing, compared with $75,300 |
| Gain taxed at 15% | $9,150 ($1,372.50 of tax) itemizing, compared with $14,700 ($2,205) |
| Tax on ordinary income | $2,125 itemizing, compared with $2,704 |
| Total savings | $832.50 on the gain + $579 on ordinary income = $1,411.50 |
Itemizing saves this couple $1,411.50 in total. The 0% band for joint filers ends at $102,100, and the deduction moved $5,550 more of their gain under that line.
The saving is modest for a reason. They gave up the $33,200 standard deduction to itemize, so only the deductions beyond that amount did any work.
Scenario 2: The High-Earner's Unexpected Surgery
A single professional earns a $560,000 salary and has a $60,000 long-term capital gain, for an AGI of $620,000. Surgery and rehab leave $80,000 of medical bills, and the filer also pays $25,000 in state and local taxes.
| 2027 Step | Result |
|---|---|
| AGI | $560,000 salary + $60,000 gain = $620,000 |
| AGI floor | 7.5% of $620,000 = $46,500 |
| Medical deduction | $80,000 – $46,500 = $33,500 |
| SALT deduction | MAGI is $109,950 over the $510,050 threshold, so the cap is cut to the $10,000 minimum |
| Total itemized deductions | $33,500 + $10,000 = $43,500, more than the $16,600 standard deduction |
| Taxable income | $576,500 itemizing, compared with $603,400 using the standard deduction |
| Gain taxed at 15% | $46,700 itemizing, compared with $19,800 (the 15% rate ends at $563,200) |
| Gain taxed at 20% | $13,300 itemizing, compared with $40,200 |
| Savings on the gain | $26,900 moves from 20% to 15%, saving $1,345 |
| Savings on salary | $26,900 less ordinary income at 35% saves $9,415 |
Total savings come to about $10,760. Most of that comes from the salary, not the gain, because the deduction removes highly taxed ordinary income before it moves any gain to a lower rate.
Two things do not change. The 3.8% NIIT still applies to the full $60,000 gain, because that tax is based on MAGI.
The 2/37 limit does not apply either, because taxable income is below $661,375, where the 37% bracket starts for single filers.
Scenario 3: The "Is It Even Worth It?" Case
A head of household taxpayer earns $150,000 and has a $20,000 long-term capital gain, so AGI is $170,000. The year brings $15,000 in medical bills and $8,000 in state and local taxes.
| 2027 Step | Result |
|---|---|
| AGI | $150,000 earnings + $20,000 gain = $170,000 |
| AGI floor | 7.5% of $170,000 = $12,750 |
| Medical deduction | $15,000 – $12,750 = $2,250 |
| Total itemized deductions | $2,250 + $8,000 of state and local taxes = $10,250 |
| Deduction choice | The 2027 standard deduction of $24,925 ($24,150 for 2026) is far larger, so they take it |
The medical bills give this taxpayer no benefit, because the standard deduction saves more. Even with $8,000 of mortgage interest added, the itemized total would be $18,250, which still falls short.
Scenario 4: Retirees Over 65 Whose Gain Is Already Taxed at 0%
A married couple, both 66, files jointly. They have $50,000 of taxable pension and individual retirement account (IRA) income and a $40,000 long-term gain, for an AGI of $90,000. They pay $20,000 in medical bills and $6,000 in property tax.
| 2027 Step | Result |
|---|---|
| AGI floor | 7.5% of $90,000 = $6,750 |
| Medical deduction | $20,000 – $6,750 = $13,250 |
| Total itemized deductions | $13,250 + $6,000 = $19,250 |
| Standard deduction | $33,200 + 2 x $1,700 = $36,600, so they do not itemize |
| Senior deduction | 2 x $6,000 = $12,000, with MAGI under $150,000 |
| Taxable income | $90,000 – $36,600 – $12,000 = $41,400 |
| Tax on the gain | All $40,000 falls in the 0% band |
The whole gain is already taxed at 0%, with or without the medical bills. The couple's taxable income sits far below the $102,100 ceiling for joint filers, so no deduction could improve the result.
Check where your gain lands before you spend time chasing the deduction. People with little other income are often surprised that a sizable long-term gain can owe no federal tax at all.
What Counts? The Official IRS-Approved List of Medical Expenses
The IRS defines a medical expense as a cost for the "diagnosis, cure, mitigation, treatment, or prevention of disease." The official list is in IRS Publication 502, and these are the main qualifying costs:
- Payments to professionals: fees paid to doctors, dentists, surgeons, chiropractors, psychiatrists and psychologists.
- Hospital and facility care: inpatient hospital stays, including meals and lodging, and treatment at addiction centers.
- Prescription medications: any legally prescribed drug, including insulin.
- Insurance premiums: medical, dental and qualified long-term care premiums paid with after-tax dollars, including Medicare Part B and Part D.
- Medical aids: glasses, contact lenses, hearing aids, crutches and wheelchairs.
- Transportation: bus fare, ambulance service, parking, tolls and mileage on your own car at the IRS medical rate.
- Specific treatments: acupuncture, doctor-prescribed weight-loss programs for a specific disease, and programs to stop smoking.
- Dental and vision: non-cosmetic dental work such as fillings and braces, eye exams, and eye surgery such as LASIK.
The 2026 medical mileage rate has two parts, because the IRS raised it at midyear. It is 20.5 cents per mile for trips from Jan. 1 through June 30, 2026, and 23.5 cents per mile for trips from July 1 through Dec. 31, 2026. The IRS has not yet announced the 2027 rate.
Mistakes to Avoid: The Six Most Common and Costly Errors
A mistake with this deduction can lead to a denied claim or an IRS audit. These six errors cause most of the trouble.
- Double-dipping with an HSA or FSA: you cannot deduct expenses paid from a health savings account (HSA) or flexible spending arrangement (FSA), because that money already got a tax break.
- Deducting general wellness costs: gym memberships, vitamins, diet foods and over-the-counter medicines such as pain relievers do not count, unless a doctor prescribed them.
- Forgetting the AGI floor: many people add up every bill and deduct the total, but only the amount above the floor counts.
- Ignoring the standard deduction: the medical deduction exists only on Schedule A, so it helps only when your itemized total beats the standard deduction.
- Including reimbursed expenses: only out-of-pocket costs count, so leave out anything your insurer or employer paid or paid back.
- Having messy records: large deductions relative to income can draw IRS scrutiny, so keep receipts, invoices and explanation of benefits statements that show what insurance did not cover.
A Step-by-Step Guide to the Math on Schedule A
The medical deduction is figured on Lines 1 through 4 of Schedule A. The line references here follow the 2025 form.
- Line 1 is for medical and dental expenses. Enter the total of all qualifying, unreimbursed medical costs you paid during the year.
- Line 2 is your AGI. Enter the amount from Form 1040 or 1040-SR, line 11b. The 2025 form splits AGI into lines 11a and 11b, while older forms used line 11.
- Line 3 is the floor. Multiply line 2 by 7.5% (0.075) to find the part of your bills you cannot deduct.
- Line 4 is your deduction. Subtract line 3 from line 1, and if the result is zero or less, you get no deduction.
A positive number on Line 4 is your medical expense deduction, and it is added to your other itemized deductions on the same form. Line 2 includes your capital gains, so every extra dollar of gain raises Line 3 and shrinks Line 4.
Better Tools for the Job: Comparing Advanced Tax Strategies
The medical expense deduction is a reactive tool, used after a hard year has already happened. Investors who plan ahead have stronger and more reliable options, and three of them are compared here.
Bunching: A Simple Timing Strategy
The AGI floor and the standard deduction are hard to clear every year. Bunching means paying for as many non-urgent procedures as you can in a single year, such as new glasses, dental work or elective surgery.
That can push your costs over both thresholds in one year. You itemize and take a large deduction that year, then take the standard deduction in the off years.
The higher SALT cap helps here. With up to $40,400 of state and local taxes allowed on a 2026 return, a bunching year clears the standard deduction more easily.
Tax-loss harvesting is the next option, and it works more directly than any medical deduction. The comparison uses the loss limits that apply to 2026 and 2027 returns.
| Feature (2026-2027) | Medical Expense Deduction | Tax-Loss Harvesting |
|---|---|---|
| How it works | Indirectly reduces tax on gains by lowering your overall taxable income. | Cancels capital gains with capital losses on Schedule D, dollar for dollar. |
| Extra benefit | None beyond the lower taxable income. | Net losses beyond gains offset up to $3,000 of ordinary income a year ($1,500 if married filing separately). The rest carries forward. |
| Best for | A last resort for taxpayers with very large, unexpected medical bills and no other planning tools. | Any investor with a taxable brokerage account who wants to manage tax on gains. |
Selling losing investments is the direct route, because capital losses offset capital gains on the same form where the gain is taxed.
A loss does not make you whole, though. You save only your tax rate on the amount lost, and the money is still gone.
The benefit is largest when a loss wipes out a short-term gain taxed at ordinary rates. People who receive employer stock over many years often hold lots bought at different prices, and selling the highest-cost lots first keeps the taxable gain small.
A health savings account attacks the problem from the other side, by sheltering money before the bills arrive. Its contribution limits change each year, so the comparison lists both years.
| Feature (2026-2027) | Medical Expense Deduction | Health Savings Account |
|---|---|---|
| Tax benefit | An itemized deduction that only counts above the AGI floor. | A triple tax advantage: deductible contributions, tax-free growth and tax-free withdrawals for medical costs. |
| Who can use it | Filers who itemize on Schedule A. | People covered by a high-deductible health plan (HDHP), whether or not they itemize. |
| Annual limit | No dollar cap. | 2026: $4,400 self-only, $8,750 family. 2027: $4,500 and $9,000. Add $1,000 at age 55 or older. |
| Best for | Dealing with medical costs you have already paid out of pocket. | Saving ahead for health costs with a deduction taken before AGI is figured. |
The 2026 limits come from Rev. Proc. 2025-19 and the 2027 limits from Rev. Proc. 2026-24.
Since the start of 2026, bronze and catastrophic Marketplace plans also count as HSA-eligible coverage. An HSA contribution reduces AGI itself, which an itemized deduction can never do.
Weighed on its own, the medical expense deduction has real strengths and real limits. Its main pros and cons line up this way.
| Pros | Cons |
|---|---|
| Provides relief in a crisis: it can save real tax in a year with catastrophic, unexpected medical costs. | High AGI floor: it is hard to qualify, especially with high income or capital gains. |
| Broad range of expenses: the IRS allows many kinds of costs, from ambulance rides to acupuncture. | Must itemize: the high standard deduction means most people never use it, even if they clear the floor. |
| Can create a bracket drop: in the right case, it lowers the rate on long-term capital gains. | Less powerful than other tools: an HSA or tax-loss harvesting usually does more. |
| Can be bunched: you can time expenses to enlarge the deduction in a single year. | Can draw IRS scrutiny: a large deduction relative to income may bring questions. |
| Available for dependents: you can include costs you paid for your spouse and qualifying dependents. | Complex record-keeping: you must track receipts and insurance reimbursements to prove your claim. |
State Law Nuances: Your State Might Be More Generous
This article covers federal tax law. Your state may have its own rules for medical expenses, and some states are more generous than the IRS.
New Jersey lets taxpayers deduct medical expenses above 2% of their income, a far lower bar than the federal floor.
North Carolina follows the federal threshold instead. Because of these differences, you might get a state deduction even when you get no federal one.
Other states give nothing. States with no income tax offer no state benefit, and some states, such as Pennsylvania, do not allow itemized medical deductions. Check your state's tax return instructions before you count on a state break.
What to Do Next
- Multiply the AGI on your latest Form 1040 by 0.075 to find your floor.
- Add up your unreimbursed medical bills for the year and subtract the floor.
- Add that result to your state and local taxes, mortgage interest and gifts to charity, then compare the total with your standard deduction.
- Compare your taxable income with the 2027 ceiling of the 0% band for long-term gains, which is $102,100 for joint filers and $51,050 for single filers.
- Before year-end, look for losses you could harvest and check whether you can still fund an HSA.
Frequently Asked Questions
Can I deduct my health insurance premiums?
Yes, if you pay them with after-tax money and itemize. Premiums paid pre-tax through an employer plan are not deductible. Self-employed people can usually deduct their premiums, including Medicare premiums, on Schedule 1 instead, with no itemizing and no AGI floor.
Are my COBRA premiums tax deductible?
Yes. COBRA premiums count as a medical expense. Include them in your medical total on Schedule A, where they are still subject to the AGI floor and the need to itemize.
Can I deduct medical expenses I paid for my adult child?
Yes, if the child qualifies as your dependent. You may also deduct expenses for a relative who would be your dependent except that they earned too much income.
What kind of records do I need to keep?
Keep receipts from providers, bank or credit card statements showing payment, and explanation of benefits forms from your insurer that show which costs were not reimbursed.
Does claiming a large medical deduction increase my audit risk?
The IRS does not publish its audit triggers. A deduction that is large compared with your income may draw questions, so keep complete records to back up every dollar you claim.
Can I deduct medical bills I paid with a credit card?
Yes. The expense counts in the year you charge it, not the year you pay the card bill. That timing rule can help when you bunch expenses into one year.
Does a medical expense deduction reduce the 3.8% net investment income tax on my gain?
No. For 2026 and 2027, that tax is figured on MAGI above $200,000 for single filers or $250,000 for joint filers, and itemized deductions do not reduce MAGI. Only lowering your investment income or MAGI, such as by harvesting losses, changes it.
Can I take the new senior deduction and still itemize my medical expenses?
Yes. The senior deduction for people 65 and older applies for 2025 through 2028. You claim it on Schedule 1-A whether you take the standard deduction or itemize on Schedule A, and it shrinks as MAGI rises past $75,000, or $150,000 for joint filers.
If I sell stock to pay medical bills, is the gain still taxed?
Yes. The gain is taxed the same no matter how you spend the money. Paying for care does not make it tax-free. Only bills above the AGI floor can be deducted, and only if you itemize. Paying from an HSA or harvesting losses can help more.
Related reading
- Can I Deduct Medical Expenses Paid With HSA? + FAQs
- How Will the 2026 Tax Law Affect High-Income Donors? (w/Examples) + FAQs
- What Is the 0.5% AGI Floor for Donations in 2026? (w/Examples) + FAQs
- Do Capital Gains Affect Medicare Costs? (w/Examples) + FAQs
- Who Can Write Off Medical Expenses? (w/Examples) + FAQs
- Can Itemized Deductions Be Carried Forward? (w/Examples) + FAQs