Tax Planning

Capital Gains Tax on Investment Sales Calculator

Enter up to 20 investment sales made in one tax year, with their dates, and see the federal income tax, the 3.8% net investment income tax and a flat state tax they add for 2025 or 2026: each sale held one year or less or more, the short-term and long-term nets, where the long-term gain falls in the 0%, 15% and 20% bands, the loss deducted and carried forward, and what you keep. Estimates for education, not tax advice.

Last updated

Calculator overview

Inputs and outputs

This summary comes from the calculator's published input and output contract.

Inputs

Your sales in the tax year (required)
About this input

The investments you sold in the tax year, one row per sale from the first row: the proceeds you received and your cost basis, both in whole dollars, the date you bought and the date you sold, as year-month-day. Up to 20 sales. A sale is long-term when it was held more than one year: sold after the same day one year after you bought it.

Default 3 rows
ColumnRange or allowed values
Proceeds 0 to 1000000000000
Cost basis 0 to 1000000000000
Date bought Not declared
Date sold Not declared
State tax rate on the gain
When omitted Blank
About this input

The rate your state taxes the gain at, as a percentage. Leave blank if your state has no income tax or you want the federal tax only. One rate stands for your state's brackets.

Unit % Default Not set Range 0 to 0.2
Tax year (required)
About this input

The tax year the sales fall in. Its federal brackets, long-term breakpoints, standard deduction and limits apply, and every sale must be dated in that year.

Default 2026 Allowed 2025, 2026
Your deductions (blank for the standard deduction)
When omitted Blank
About this input

Your total deductions for the year, in whole dollars. Leave blank to use the standard deduction for the tax year and filing status; enter your own figure if you itemize or take other deductions.

Unit currency Default Not set Range 0 to 1000000000000
Filing status (required)
About this input

Your filing status for the year. A qualifying surviving spouse uses married filing jointly, which has the same figures here.

Default Single Allowed Single, Married filing jointly, Married filing separately, Head of household
Other income for the year, before deductions (required)
About this input

Your other income for the year before deductions, in whole dollars: wages, interest, retirement income and the like, without the sales you enter. It is treated as ordinary income, and your gains are stacked on top of it.

Unit currency/yr Default 60000 Range 0 to 1000000000000

Outputs

Net short-term gain or loss
About this output

The net gain or loss of the sales held one year or less. Short-term gains are taxed as ordinary income.

Unit currency
Your sales, one by one
About this output

Each sale with its dates, how long it was held, whether that is one year or less or more, and its gain or loss.

No unit declared
Workbook self-check
About this output

PASS when every internal consistency check of the calculation holds for this result. FAIL means the result should not be relied on.

No unit declared
Net long-term gain or loss
About this output

The net gain or loss of the sales held more than one year. Long-term gains are taxed at 0%, 15% or 20%, depending on where they land on top of your other taxable income.

Unit currency
What you keep after tax
About this output

The total proceeds of your sales less the federal income tax, the net investment income tax and the state tax on them: what you keep from the sales after tax.

Unit currency
Net gain or loss on these sales
About this output

The proceeds less the cost basis, added over all your sales. A negative figure is a net loss.

Unit currency
Net investment income tax on these sales
About this output

The 3.8% net investment income tax the sales add. It applies to the lesser of the gain included in income and the amount by which your adjusted gross income exceeds the threshold for your filing status.

Unit currency
Total cost basis
About this output

The cost basis of all your sales, added.

Unit currency
Total proceeds
About this output

The proceeds of all your sales, added.

Unit currency
Total tax on these sales
About this output

The federal income tax, the net investment income tax and the state tax that these sales add to your year, together. A negative figure is a tax saving from a net loss.

Unit currency
Federal income tax on other income alone
About this output

The federal income tax on your other income alone, without the sales. The tax on the sales is measured from it.

Unit currency
State tax on these sales Conditional
About this output

The state tax rate you entered times the capital gain included in income, never below zero. Shown when you enter a state rate above 0.

Unit currency
Taxable income with these sales
About this output

Your taxable income with the sales: other income plus the capital gain included, less the deduction, and never below zero.

Unit currency
From proceeds to what you keep
About this output

The steps from your total proceeds to what you keep: the cost basis, the gain or loss, each tax, the gain after tax and the proceeds after tax.

No unit declared
Tax as a share of your net gain
About this output

The total tax on the sales as a share of their net gain. It reads 0 when the sales show no net gain.

Unit %
Federal income tax on these sales
About this output

The federal income tax these sales add: the tax on your year with the sales less the tax without them, so it includes the effect of the sales on the rates your other income meets. Negative when a net loss lowers your tax. It uses the exact federal rate schedules; the IRS Tax Table, used on returns with less than 100,000 dollars of taxable income, can differ by a few dollars.

Unit currency
Long-term gain taxed at 0%
About this output

The part of your long-term gain in taxable income that falls below the year's 0% breakpoint for your filing status.

Unit currency
Deduction used
About this output

The deduction the calculation used: your figure, or the standard deduction for the tax year and filing status when you left it blank.

Unit currency
Where your long-term gain falls in the rate bands
About this output

The three long-term rate bands for your tax year and filing status, with how much of your other taxable income and of your long-term gain sits in each, the tax on the gain there, and the room left before the next band.

No unit declared
Long-term part of the loss carried forward
About this output

The long-term part of the loss carried forward.

Unit currency
Short-term part of the loss carried forward
About this output

The short-term part of the loss carried forward. The short-term loss is used against this year's deduction first.

Unit currency
Long-term rate band reached
About this output

The long-term rate band your taxable income with these sales reaches: 0%, 15% or 20%. It is a band, not the tax on one more dollar of long-term gain, which can differ: one more dollar can cost 12% through the regular-tax comparison, the ordinary rate when it only reduces a long-term loss set against a short-term gain, and nothing this year when it only reduces a loss carried forward.

Unit %
Ordinary tax bracket reached
About this output

The rate of the federal bracket your ordinary taxable income with these sales reaches; on a bracket line it reads the higher bracket. It is a bracket, not the tax on one more dollar, which can differ: one more dollar costs nothing while your income is below your deduction (this still reads 10%), and costs more when it pushes long-term gain from the 0% band into the 15% band.

Unit %
Model Status
About this output

Whether the inputs describe sales the calculator can compute. NOT VALID names what to fix, CHECK flags a result to notice, such as a net loss that cannot all be used this year, and OK means neither applies.

No unit declared
Loss deducted from other income this year
About this output

The net capital loss set against your other income on the return this year, up to the yearly limit (Schedule D line 21). When your other income is less than your deduction plus this loss, the part that would take taxable income below 0 lowers nothing and is counted again in the loss carried forward.

Unit currency
Long-term gain taxed at 15%
About this output

The part of your long-term gain in taxable income that falls between the 0% and 20% breakpoints, taxed at 15%.

Unit currency
Long-term gain taxed at 20%
About this output

The part of your long-term gain in taxable income above the year's 20% breakpoint.

Unit currency
Loss carried forward to next year Conditional
About this output

The part of a net capital loss not used this year: the part above the yearly limit (3,000 dollars, 1,500 if married filing separately), and any deducted part that did not lower your taxable income because your taxable income reached 0. It carries forward to later years. Shown only when there is one.

Unit currency
This page is provided by LogicCommons for informational purposes only. Results are model outputs computed from the inputs you supply and are not financial, investment, tax, accounting, or legal advice, and no advisory relationship is created. Verify all inputs and results independently before relying on them in any decision.

LogicCommons is in beta. If a result, label, or reference looks wrong, tell us here; we read every message.

Methodology

Purpose and model boundary

This calculator works out the federal income tax, the 3.8% net investment income tax and a flat state tax that a year's investment sales add, for tax year 2025 or 2026. You enter up to 20 sales, each with its proceeds, its cost basis, the date bought and the date sold, and your tax situation: the tax year, your filing status, your other income before deductions and, if you wish, your own deductions and a state tax rate. The workbook sorts each sale into held one year or less or held more than one year, nets the gains and losses, applies the yearly limit on a net loss and the carryforward, and runs the federal tax calculation twice, with your sales and without them. The tax on the sales is the difference. The main result is what you keep: the total proceeds less the tax.

For one sale with both holding periods side by side, use the Capital Gains Tax Calculator; for the value of selling at a loss to offset gains, the Tax Loss Harvesting Benefit Calculator; and for the cost basis and holding periods of repeated crypto purchases, the Crypto DCA Cost Basis Calculator.

For an investment property, where unrecaptured section 1250 gain is taxed at up to 25% and a 1031 like-kind exchange can defer the tax, use the Like Kind Exchange 1031 Deferral Calculator.

Every figure on this page is computed by the spreadsheet; the page adds nothing to it. The model is educational. It is not a tax return, and it is not financial, investment, tax or legal advice.

Inputs and units

  • Your sales in the tax year: one row per sale from the first row, up to 20. Each needs the proceeds you received and your cost basis, each in whole dollars from 0 to 1 trillion dollars, and the date bought and the date sold, as year-month-day between 1970 and 2099. A sale must be on or after the date it was bought, and every sale must be dated in the tax year you choose.
  • Tax year: 2025 or 2026. Its federal brackets, long-term breakpoints, standard deduction and limits apply.
  • Filing status: single, married filing jointly, married filing separately or head of household. A qualifying surviving spouse uses married filing jointly, which has the same figures in every table used here.
  • Other income for the year, before deductions, in whole dollars from 0 to 1 trillion dollars: wages, interest, retirement income and the like, without the sales you enter. It is treated as ordinary income, and your gains are stacked on top of it.
  • Your deductions, optional, in whole dollars from 0 to 1 trillion dollars. Leave it blank to use the standard deduction for the tax year and filing status.
  • State tax rate on the gain, optional, from 0% to 20%. Leave it blank for no state tax. One flat rate stands for your state's rules.

Money is in US dollars; rates are percentages.

Governing relationships

Each sale's gain or loss is its proceeds less its cost basis. A sale is long-term when the date sold is after the same day one year after the date bought, so a sale on the anniversary itself is still short-term; this follows the IRS rule that the holding period starts the day after you buy and includes the day you sell. The short-term results are added together, and so are the long-term results; the two nets are then set against each other.

When the sales show a net loss, up to 3,000 dollars of it (1,500 if married filing separately) is deducted from your other income, and the rest carries forward to later years, the short-term loss counted first. As on the IRS Capital Loss Carryover Worksheet, the deducted loss counts as used only as far as it lowered your taxable income, so when your income is already below your deduction, more of the loss carries forward.

The federal tax follows the IRS Qualified Dividends and Capital Gain Tax Worksheet. Taxable income is your other income plus the capital gain included, less the deduction, and never below 0. The part of taxable income that is long-term gain sits on top of the ordinary part and is taxed at 0% up to the year's 0% breakpoint for your filing status, at 15% up to the 20% breakpoint, and at 20% above it; the ordinary part is taxed at the year's rate schedule. The tax is the smaller of that sum and the regular tax on all taxable income, as the worksheet's last line directs. The workbook does this once with your sales and once without them:

federal tax on the sales = tax with the sales − tax without them

The net investment income tax is 3.8% of the smaller of the gain included in income and the amount by which adjusted gross income exceeds the threshold for your filing status, again with the sales less without them; only the sales you enter count as investment income. The state tax is your state rate times the capital gain included in income, never below 0. Then

what you keep = total proceeds − (federal tax + net investment income tax + state tax)

and the effective rate is the total tax over the net gain, read as 0 when there is no net gain.

The figures each tax year uses are kept in the workbook by year, each with its source and the date it was read:

Figure (single · married filing jointly · married filing separately · head of household) 2025 2026
Top of the 0% long-term band, taxable income 48,350 · 96,700 · 48,350 · 64,750 49,450 · 98,900 · 49,450 · 66,200
Top of the 15% long-term band, taxable income 533,400 · 600,050 · 300,000 · 566,700 545,500 · 613,700 · 306,850 · 579,600
Standard deduction 15,750 · 31,500 · 15,750 · 23,625 16,100 · 32,200 · 16,100 · 24,150
Net investment income tax threshold, adjusted gross income 200,000 · 250,000 · 125,000 · 200,000 the same; the thresholds are not indexed for inflation
Yearly limit on a net capital loss 3,000 · 3,000 · 1,500 · 3,000 the same

Calculation sequence

The spreadsheet first checks the sales and the other inputs. It then computes each sale's gain, days held and holding period, the short-term and long-term nets, the loss deducted and carried forward, the federal tax calculation with and without the sales for the chosen year and filing status, the net investment income tax and the state tax, and finally the steps from your proceeds to what you keep and the three long-term bands. A block of consistency checks confirms the arithmetic before the status is returned.

Outputs and interpretation

The headline is what you keep after tax. The cards show the total tax on the sales, the tax as a share of your net gain, the federal income tax, the net investment income tax, the state tax (shown when you enter a state rate above 0), the net gain or loss, the net short-term and net long-term results, and the loss carried forward (shown only when there is one). The tables show each sale, the three long-term rate bands with how much of your other taxable income and of your long-term gain sits in each, and the steps from your proceeds to what you keep. The total proceeds and cost basis, the loss deducted, the short-term and long-term parts of the carryforward, your taxable income, the deduction used, the long-term gain at 0%, 15% and 20%, the ordinary tax bracket your ordinary taxable income reaches and the long-term rate band your taxable income reaches, the federal tax without the sales and the workbook's self-check are returned to the API and MCP.

The federal and net investment income tax figures are what the sales add to your year, not your whole year's tax; a negative figure is a saving from a net loss. Under the default inputs, three sales in 2026 by a single filer with 60,000 dollars of other income and the standard deduction of 16,100, the sales gain 14,000 dollars: 12,500 long-term and 1,500 short-term. Of the long-term gain, 4,050 fits under the 0% breakpoint of 49,450 above the 45,400 of ordinary taxable income, and 8,450 is taxed at 15%. The federal tax the sales add is 1,447.50 dollars, 12% of the short-term 1,500 plus 15% of 8,450; there is no net investment income tax, and you keep 36,552.50 of the 38,000 proceeds, an effective rate of 10.34%.

The first chart steps from the total proceeds to what you keep. Each bar starts at zero and is one figure from the workbook; each tax is a red bar below zero, or a green bar above it for a saving. The second chart shows, for each long-term band, how much of your other taxable income and of your long-term gain sit in it, which is why a gain added to a high income meets a higher rate.

Validation and status logic

The workbook evaluates the conditions below from top to bottom and returns the first matching status.

Priority Condition Returned status
1 A sale row is partly filled NOT VALID: each sale needs the proceeds, the cost basis, the date bought and the date sold
2 No sale is entered, or an empty row sits between sales NOT VALID: list your sales from the first row, with no empty rows between them
3 A date is not a date, is outside 1970 to 2099, or a sale comes before its purchase NOT VALID: each date must be a valid date from 1970 to 2099, and each sale must be on or after the date it was bought
4 A sale is dated outside the chosen tax year NOT VALID: every sale must be dated in the tax year you chose
5 A proceeds or cost basis amount is not a whole number of dollars or is outside the supported interval NOT VALID: the proceeds and the cost basis of each sale must be whole dollars from 0 to 1 trillion dollars
6 The tax year is not one of the choices NOT VALID: choose a tax year from the list (2025 or 2026)
7 The filing status is not one of the choices NOT VALID: choose a filing status from the list
8 Other income is not a whole number of dollars or is outside the supported interval NOT VALID: other income must be whole dollars from 0 to 1 trillion dollars
9 Deductions are entered and are not a whole number of dollars or are outside the supported interval NOT VALID: deductions must be blank or whole dollars from 0 to 1 trillion dollars
10 A state tax rate is entered and outside the supported interval NOT VALID: the state tax rate must be blank or from 0% to 20%
11 The workbook's self-check fails CHECK: the self-check of the workbook failed for this result, so do not rely on it; please report it
12 Some of a net capital loss cannot be used this year CHECK: some of your net capital loss cannot be used this year and carries forward to later years
13 None of the preceding conditions applies OK

NOT VALID is a refusal, not a numeric answer: every number reads zero and the tables are empty. CHECK accompanies a computed result but calls for the stated review. The self-check is reported separately as arithmetic-integrity evidence; it does not replace this ordered status chain.

Assumptions and limitations

The ordinary tax uses the exact federal rate schedules. A return with less than 100,000 dollars of taxable income uses the IRS Tax Table, which taxes 50-dollar bands at their midpoint, so a filed return can differ by a few dollars. The model does not include qualified dividends or other investment income, collectibles taxed at up to 28% or unrecaptured section 1250 gain, a capital loss carried in from an earlier year, wash sales, the alternative minimum tax, the additional standard deduction for age or blindness or the senior deduction (enter your own deductions instead), or a tax for each sale on its own, which is not well defined when sales net against each other. It also leaves out inherited property, which is long-term whatever the dates, and gifts, whose holding period usually includes the giver's. The state tax is one flat rate on the gain and does not follow any state's brackets or loss rules. A sale bought on 29 February counts as held more than one year from 1 March of the next year, which follows from the IRS counting rule; the IRS does not address that date directly.

A sale of shares from an employee stock purchase plan can include ordinary income that this page does not separate from the gain. To compare selling such shares, or vested restricted stock units, now with holding them to the qualifying or long-term date, use the ESPP and RSU Hold or Sell Calculator.

Restrictions and non-computing states

This calculator enforces its numeric and choice limits before it accepts a result. The tax year and filing status come from their lists; a sale dated outside the chosen year, a sale before its purchase, a partly filled row and a gap between rows are refused by the workbook. Blank deductions mean the standard deduction, and a blank state rate means no state tax.

Errors and warnings

A request rejected by the page's input limits is not a computed result. A transport or service failure cannot establish a fresh workbook answer. Review the workbook's References and Disclaimer and current tax rules with a qualified professional before using a result for a real decision.

References

Sources and further reading

Your sales, income, deductions and state rate come from the inputs. The federal figures for each tax year come from the IRS sources below, kept in the workbook by year with the date each was read; the workbook's References sheet identifies them. The links explain the rules the model follows; they do not endorse this calculator.

  • Revenue Procedure 2024-40, section 3.01 and section 3.03, gives the 2025 rate schedules and the 0% and 15% long-term breakpoints for each filing status (retrieved 2026-10-15).
  • Revenue Procedure 2025-32, section 4.01, section 4.03 and section 4.14, gives the 2026 rate schedules, long-term breakpoints and standard deductions, and section 2.08 the 2025 standard deductions as amended by Public Law 119-21, which replace those in Revenue Procedure 2024-40 (retrieved 2026-10-15).
  • IRS Topic 409, Capital gains and losses, explains the more-than-one-year rule for long-term gains, the 0%, 15% and 20% rates, and the yearly limit of 3,000 dollars, or 1,500 if married filing separately, on a net capital loss (retrieved 2026-10-15).
  • Instructions for Form 1040 (2025), Qualified Dividends and Capital Gain Tax Worksheet, sets out how the long-term gain is stacked on ordinary taxable income and that the tax is the smaller of that figure and the regular tax; it also says the IRS Tax Table is used below 100,000 dollars of taxable income (retrieved 2026-10-15).
  • Instructions for Schedule D (Form 1040) (2025), Capital Losses and the Capital Loss Carryover Worksheet, explain the loss limit and how the short-term and long-term carryforwards are figured (retrieved 2026-10-15).
  • IRS Publication 544 (2025), chapter 4, "Holding period", explains that counting starts the day after you acquire an asset and includes the day you dispose of it, so a sale on the anniversary is not held longer than one year (retrieved 2026-10-15).
  • IRS Questions and Answers on the Net Investment Income Tax gives the 3.8% rate, the thresholds for each filing status and that they are not indexed for inflation (retrieved 2026-10-15).
  • Microsoft Support's EDATE and SUMPRODUCT documentation describe the date and summing functions the workbook uses for the one-year test and the rate schedules.

This is an educational estimate, not financial, investment, tax or legal advice. Tax rules and figures change every year and depend on your whole return; check them against current IRS guidance and a qualified professional.

Results are informational and not professional advice. See our Terms of Use. Powered by SpreadsheetWeb · About · Privacy · Terms