Portfolio Planning and Risk

Tax Aware Rebalancing Calculator

Rebalance up to 12 holdings with taxes in view: each holding outside its band is traded back to its target, each sell takes that holding's highest-cost lots first, and you see the federal income tax, the 3.8% net investment income tax and a flat state tax the sells add for 2025 or 2026, the short-term and long-term gains realised, the cash left after the buys, and the new money and months of contributions that would bring every holding with a target above 0 to its target without selling. 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

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
Your tax lots, each naming its holding (required)
About this input

The tax lots of the holdings you may sell, one row per lot from the first row: the holding it belongs to (named as in the holdings table; spaces and capitals do not matter), the date bought as year-month-day, the units (at least 0.000001; fractions allowed) and the cost basis in whole dollars. A holding you only buy or leave alone needs no lots of its own, but the table must hold at least one lot row. Up to 200 lots.

Default 2 rows
ColumnRange or allowed values
Holding Not declared
Date bought Not declared
Units 1E-06 to 1000000000000
Cost basis 0 to 1000000000000
Date of the trades (required)
About this input

The day the rebalancing trades are made. A lot sold on this date is long-term when it was held more than one year; the date must fall in the tax year you choose, and every lot must be bought on or before it.

Unit date Default 2026-09-15
Tax year (required)
About this input

The tax year the trades fall in. Its federal brackets, long-term breakpoints, standard deduction and limits apply.

Default 2026 Allowed 2025, 2026
Your holdings: name, target, current value and band (required)
About this input

Your holdings, one row per holding from the first row: a name, its target share of the portfolio as a whole percentage, its current value in whole dollars and its band, the drift from target in whole percentage points allowed before it is traded. The targets add up to 100%. Up to 12 holdings.

Default 3 rows
ColumnRange or allowed values
Holding Not declared
Target 0 to 1
Current value 0 to 1000000000000
Band (percentage points) 0 to 1
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
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
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 these trades. It is treated as ordinary income, and the gains the trades realise are stacked on top of it.

Unit currency/yr Default 90000 Range 0 to 1000000000000
Your monthly contribution (required)
About this input

What you add to the portfolio each month, in whole dollars. It is used only for the plan that rebalances with new money instead of selling: the months that plan takes are the new money divided by this amount, rounded up.

Unit currency/month Default 1000 Range 1 to 1000000000000

Outputs

Tax the rebalancing trades add
About this output

The federal income tax, the net investment income tax and the state tax that the sells of this rebalancing add to your year, together: the tax with the trades less the tax without them. A negative figure is a tax saving from a realised loss. It counts this year only; a loss beyond the yearly limit carries forward and is not valued here.

Unit currency
Total bought
About this output

The total of the buys, in dollars: each holding under its band bought up to its target. The buys are not scaled to the cash the sells raise.

Unit currency
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
State tax the trades add
About this output

The state tax rate you entered times the capital gain the sells include in income, never below zero.

Unit currency
Total sold
About this output

The total of the sells, in dollars: each holding over its band sold down to its target.

Unit currency
Holdings traded back to target
About this output

How many holdings are outside their band and are traded back to their target. A holding exactly at its band edge is not traded.

Unit holdings
The largest drift from target
About this output

The drift of the holding furthest from its target, in percentage points: positive when it is over its target, negative when it is under. On a tie the first such holding in the table is shown.

Unit %
Long-term gain or loss realised
About this output

The gain or loss the sells realise on lots held more than one year, in whole dollars: each lot's proceeds and cost are rounded to whole dollars, half a dollar up, before they are added. Long-term gains are taxed at 0%, 15% or 20%, depending on where they land on top of your other taxable income.

Unit currency
Short-term gain or loss realised
About this output

The gain or loss the sells realise on lots held one year or less, in whole dollars: each lot's proceeds and cost are rounded to whole dollars, half a dollar up, before they are added. Short-term gains are taxed as ordinary income.

Unit currency
Each holding against its target and band
About this output

Each holding with its target, its current weight, its drift from target, its band, whether it is outside the band, and the trade that brings it back to target (a sell below 0, a buy above).

No unit declared
Federal income tax the trades add
About this output

The federal income tax the sells add: the tax on your year with the trades less the tax without them. Negative when a realised 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
Cash left after the trades
About this output

The total sold less the total bought, in dollars. A positive figure is cash left over; a negative figure is cash you add to make the buys.

Unit currency
Where to direct new money instead of selling
About this output

Where to direct new money instead of selling: for each holding, the new money it needs to reach its target without selling, the part of each monthly contribution to send it, and the months that takes.

No unit declared
Your lots and the units each sale takes
About this output

Each lot with its holding, the date bought, its units and unit cost, whether it is held one year or less or more on the trade date, the units the rebalancing sells from it (each holding's highest-cost lots first; a holding with a 0% target that actually sells, outside its band, sells every unit) and the gain or loss on those units in whole dollars: the lot's proceeds less its cost, each rounded to whole dollars. The units sold are worked out lot by lot from the units each trade asks for; with fractional units next to very large lots they can differ from that request, up or down, and each lot's dollars use the units it actually sells. Very large inputs give approximate results.

No unit declared
Net investment income tax the trades add
About this output

The 3.8% net investment income tax the sells 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
New money that would rebalance without selling
About this output

The new money that would bring every holding with a target above 0% to its target without selling anything, in dollars: enough to lift each underweight holding to the share its target asks of the larger total. A holding you still hold at a 0% target is left as it is: new money cannot bring it to 0%, only a sale can, so the figure then does not reach every target. Growth during the months it takes is ignored.

Unit currency
Model Status
About this output

Whether the inputs describe a portfolio the calculator can rebalance. NOT VALID names what to fix, CHECK flags a result to notice, such as every holding being inside its band so that nothing is traded, and OK means neither applies.

No unit declared
Months of contributions to rebalance without selling
About this output

How many months of your monthly contribution the new money takes, rounded up to a whole month and at least 1 whenever new money is needed; 0 when no new money is needed. Each month's contribution is split in proportion to what each holding needs. Growth during those months is ignored.

Unit months
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 rebalances a portfolio with the tax in view, for tax year 2025 or 2026. You enter up to 12 holdings, each with a target, its current value and a band in percentage points, and up to 200 tax lots, each naming its holding with the date bought, the units and the cost basis. At least one lot row is needed, and only a holding you sell needs its own lots. You also enter the date of the trades, what you add each month and your tax situation. Every holding that has drifted outside its band is traded back to its target. Each sell takes that holding's own lots, highest cost first, and the short-term and long-term gains or losses the sells realise are run through the federal tax calculation twice, with the trades and without them. The main result is the tax the rebalancing trades add, which can be a saving when the sells realise a loss. Beside it, the calculator works out the new money that would bring every holding with a target above 0 to its target without selling anything (a holding still held at a 0% target needs a sale), and how many months of your contribution that takes.

This is the tax-aware variant of the Asset Allocation Rebalancing Calculator, which tests the bands and plans the trades without lots or tax. To estimate the tax on sales you have already made, use the Capital Gains Tax on Investment Sales Calculator. To compare the order in which lots are sold, use the Tax Lot Selection Method 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 trading instruction or a tax return, and it is not financial, investment, tax or legal advice.

Inputs and units

  • Your holdings: one row per holding from the first row, at least two and up to 12. Each needs a name used only once, a target and a band, each a whole percentage from 0% to 100%, and a current value in whole dollars from 0 to 1 trillion. The targets must add up to 100%. The band is in percentage points: a 60% target with a 5-point band holds anywhere from 55% to 65%.
  • Your tax lots: one row per lot from the first row, up to 200. Each needs the name of one of your holdings (capitals and extra spaces are ignored), the date bought, the units, at least 0.000001 and at most 1 trillion, and the cost basis in whole dollars from 0 to 1 trillion. A holding that is never sold needs no lots; a holding that must be sold needs its lots.
  • Date of the trades, as year-month-day. It must fall in the tax year you choose, and every lot must be bought on or before it.
  • Your monthly contribution, in whole dollars from 1 to 1 trillion.
  • Tax year: 2025 or 2026. 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: wages, interest and the like, without these trades. It is treated as ordinary income.
  • Your deductions, optional, in whole dollars from 0 to 1 trillion. 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.

Every amount of money you enter is in whole US dollars, and targets and bands are whole percentage points; a fraction is refused, never rounded. Units may be fractional.

Governing relationships

The total value is the sum of the current values. Each holding's weight is its value over the total, and its drift is the weight less its target. A holding is outside its band when its drift, ignoring its sign, is more than its band; a holding exactly at its band edge is inside and is not traded. A holding outside its band is traded back to its target:

trade = target × total value − current value

A negative trade is a sell and a positive one a buy. The buys are not scaled to the cash the sells raise: the cash left is the total sold less the total bought, and a negative cash left is cash you add.

The price per unit of a holding is its current value over the units in its lots. A sell of a holding takes that holding's own lots, highest unit cost first, which at one price is the lowest gain per unit: whole lots in that order and at most one lot in part. A holding with a 0% target that actually sells (its trade is below zero, so it is outside its band) sells every one of its lots in full; a 0% holding inside its band does not trade. Each lot's proceeds are the units it gives up times the price, and its cost is its whole cost basis when the whole lot is sold, else the units it gives up times its cost per unit; each is rounded to whole dollars, half a dollar up, before any netting, and its gain is the proceeds less the cost. A lot is long-term when the trade date is after the same day one year after the date bought, so a lot sold on its anniversary 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 realised short-term and long-term results are netted against each other. The federal tax follows the IRS Qualified Dividends and Capital Gain Tax Worksheet for the chosen year and filing status: a long-term gain sits on top of the ordinary part of taxable income at 0%, 15% or 20%, and a net loss up to the yearly limit of 3,000 dollars (1,500 if married filing separately) is deducted from other income. The workbook does this once with the trades and once without them:

federal tax the trades add = tax with the trades − 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 trades less without them. The state tax is your state rate times the gain included in income, never below 0. Then

tax the rebalancing trades add = federal tax + net investment income tax + state tax

Rebalancing with new money instead: with no selling, every holding with a target above 0 reaches its target at a new total equal to the largest value over target. Each holding needs its target times that total less its value, never less than 0 (a share below half a cent is rounding dust and counts as 0), and the new money is the sum of those amounts. A holding you still hold at a 0% target cannot reach its target this way: new money never lowers a holding, so only a sale can bring it to 0%, and the new money then covers only the holdings with a target above 0. The months are the new money over your monthly contribution, rounded up to whole months and at least 1 whenever new money is needed. Growth during the months is ignored.

Calculation sequence

The spreadsheet first checks the holdings, the lots and the other inputs. It then computes the total value, each holding's weight, drift and band test, the trades, the cash left, the price and units to sell of each holding that sells, the units each lot gives up and its gain, the short-term and long-term nets, the federal tax calculation with and without the trades for the chosen year and filing status, the net investment income tax and the state tax, and finally the new money and months that would bring every holding with a target above 0 to its target without selling. A block of consistency checks confirms the arithmetic before the status is returned.

Outputs and interpretation

The headline is the tax the rebalancing trades add; a negative figure is a saving from a realised loss. The cards show the number of holdings traded back to target, the total sold, the total bought, the cash left after the trades, the short-term and long-term gain or loss realised, the new money that would bring the holdings with a target above 0 to their targets without selling (a holding held at a 0% target needs a sale), the months of contributions that takes (at least 1 when any is needed), and the largest drift from target, signed so that a holding over its target is positive. The tables show each holding against its target and band with its trade, your lots with the units each sale takes and its gain, and where to direct new money instead of selling. The federal income tax, net investment income tax and state tax the trades add, and the workbook's self-check, are returned to the API and MCP.

Under the default inputs, stocks, bonds and cash at targets of 60%, 30% and 10% with 5-point bands are worth 75,000, 20,000 and 5,000 dollars, so their weights are 75%, 20% and 5%. Stocks are 15 points over target and bonds 10 points under, so both trade: 15,000 dollars of stocks are sold and 10,000 dollars of bonds bought, leaving 5,000 dollars of cash. Cash is 5 points under target, exactly at its band edge, so it is not traded. The stocks are worth 100 dollars a unit, so 150 units are sold, all from the lot bought on 2 March 2026 at 120 dollars a unit, the highest cost: a short-term loss of 3,000 dollars. For a single filer in 2026 with 90,000 dollars of other income and the standard deduction of 16,100, the loss lowers taxable income from 73,900 to 70,900 dollars in the 22% bracket, so the trades save 660 dollars of federal tax; there is no net investment income tax or state tax. Selling the older lot first instead would have realised a long-term gain. Without selling, the stocks already reach their target at a total of 125,000 dollars, so 25,000 dollars of new money, 17,500 to bonds and 7,500 to cash, would rebalance in 25 months at 1,000 dollars a month.

The first chart shows each holding's drift from its target as one horizontal bar: red when it is over its band, blue when it is under, grey when it is inside. The second chart steps from the sells to the cash left. 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.

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 holding row is partly filled NOT VALID: each holding needs its name, target, current value and band
2 Fewer than two holdings, or an empty row between them NOT VALID: list at least two holdings from the first row, with no empty rows between them
3 A holding name is missing or used twice NOT VALID: each holding needs its own name, used only once
4 A target, band or current value is outside the supported interval or not whole NOT VALID: each target and band must be a whole percentage from 0% to 100%, and each current value whole dollars from 0 to 1 trillion dollars
5 The targets do not add up to 100% NOT VALID: the targets must add up to 100%
6 The current values add up to 0 NOT VALID: the current values must add up to more than 0
7 A lot row is partly filled NOT VALID: each lot needs its holding, the date bought, the units and the cost basis
8 An empty row sits between lots NOT VALID: list your lots from the first row, with no empty rows between them
9 A lot names no holding NOT VALID: each lot must name one of your holdings
10 The trade date is not a valid date NOT VALID: the trade date must be a valid date
11 A lot date is not valid or is after the trade date NOT VALID: each lot needs a valid date bought, on or before the trade date
12 A lot's units or cost basis is outside the supported interval or the basis is not whole NOT VALID: the units of each lot must be at least 0.000001 and at most 1 trillion, and its cost basis whole dollars from 0 to 1 trillion dollars
13 The tax year is not one of the choices NOT VALID: choose a tax year from the list (2025 or 2026)
14 The trade date is outside the chosen tax year NOT VALID: the trade date must be in the tax year you chose
15 The filing status is not one of the choices NOT VALID: choose a filing status from the list
16 The monthly contribution is outside the supported interval or not whole NOT VALID: the monthly contribution must be whole dollars from 1 to 1 trillion dollars
17 Other income is outside the supported interval or not whole NOT VALID: other income must be whole dollars from 0 to 1 trillion dollars
18 Deductions are entered and outside the supported interval or not whole NOT VALID: deductions must be blank or whole dollars from 0 to 1 trillion dollars
19 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%
20 A holding that must be sold has no lots NOT VALID: a holding you must sell needs its lots listed, so the tax on the sale can be worked out
21 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
22 Every holding is inside its band CHECK: every holding is inside its band, so there is nothing to trade and no tax
23 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

Every holding is treated as held in a taxable account, and each sell takes its highest-cost lots first; lots you choose by hand and average-cost basis for fund shares are not modelled. The trades are made at today's values: trading costs and spreads, and price changes before the trades and during the months of the new-money plan, are ignored. The model does not include wash sales, which can disallow a loss when the same or a substantially identical security is bought within 30 days before or after the sale; a loss beyond the yearly limit, which carries forward to later years (the tax the trades add counts this year only); your other sales earlier in the year; qualified dividends and other investment income (other income is treated as ordinary income, and the net investment income tax counts only these trades); collectibles and unrecaptured section 1250 gain; the alternative minimum tax; or the additional deductions for age 65 or over and itemized deduction limits (enter your own deductions to include them). The ordinary tax uses the exact federal rate schedules, not the IRS Tax Table, so a filed return can differ by a few dollars below 100,000 dollars of taxable income. The state tax is one flat rate on the gain and does not follow any state's brackets, deductions or credits, or local taxes.

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 partly filled row, a gap between rows, a repeated holding name, targets that do not add up to the whole, a lot that names no holding, a lot bought after the trade date, a trade date outside the chosen year, and a holding that must be sold without its lots 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 holdings, lots, income, deductions and state rate come from the inputs. The federal figures for each tax year come from the two Revenue Procedures, Topic 409 and the IRS questions and answers on the net investment income tax. They are kept in the workbook by year with the date each was read, and the workbook's References sheet lists them with the two Microsoft functions. The Form 1040 and Schedule D instructions, Publication 544, Publication 550 and 26 U.S.C. 1091 are added on this page as further explanation; the workbook's References sheet does not list them. The links explain the rules the model follows; they do not endorse this calculator.

  • Revenue Procedure 2024-40, section 2.01 and section 2.03, gives the 2025 rate schedules and the 0% and 15% long-term breakpoints for each filing status (retrieved 2026-10-20).
  • 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 3.01 the 2025 standard deductions as amended by Public Law 119-21; section 2.08 describes the change (retrieved 2026-10-20).
  • 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-20).
  • 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 (retrieved 2026-10-20).
  • Instructions for Schedule D (Form 1040) (2025) explain how short-term and long-term gains and losses are reported (Parts I and II) and the limit on a net capital loss (retrieved 2026-10-20).
  • 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 lot sold on its anniversary is not held longer than one year (retrieved 2026-10-20).
  • 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-20).
  • IRS Publication 550 (2025), chapter 4, "Wash Sales", and 26 U.S.C. 1091 describe the wash-sale rule, which can disallow a loss when substantially identical securities are acquired within 30 days before or after the sale. The model does not apply it (retrieved 2026-10-20).
  • Microsoft Support's EDATE and SUMPRODUCT documentation describe the date and summing functions the workbook uses for the one-year test, the lot order 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 before you trade or file.

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