Calculator overview
Inputs and outputs
This summary comes from the calculator's published input and output contract.
Inputs
- Other Taxable Income (required)
-
Unit $ Default 87460 Range 0 to 2000000
About this input
Everything else you are taxed on this year, after your deductions and before this sale. It is taxable income rather than gross pay, and the difference matters more here than anywhere else in the model: the gain is laid on top of this figure, so entering a gross number puts the gain in a higher layer than it belongs in and overstates the tax. Enter nothing if the sale is your only taxable income.
- Sale Proceeds (required)
-
Unit $ Default 25000 Range 0 to 5000000
About this input
What the sale actually brought in, after the commission or fee the broker took out of it. It is the gross figure on the sale and not the profit: the profit is worked out here by taking the cost basis off it. Enter nothing rather than a negative number if the sale brought in nothing at all.
- State Rate
-
When omitted Blank
Unit fraction Default Not set Range 0 to 0.133
About this input
Optional. A single flat percentage applied to the whole gain, and a stand-in rather than any state's rules. Leave it blank where there is no state tax on the gain, which is the case in several states. It is one rate because fifty schedules that move every year would go stale faster than this calculator is revised, and because states differ in kind and not only in rate: some exclude part of a long-term gain, some tax it as ordinary income, some add a surcharge above a threshold, and one charges an excise tax on the sale rather than an income tax on the gain.
- MAGI Before Sale
-
When omitted Blank
Unit $ Default Not set Range 0 to 2000000
About this input
Optional, and it exists because the surtax keys off a different figure from the rate layers. Leave it blank and the surtax is measured against your other taxable income, which is right when the two are the same. Fill it when your modified adjusted gross income before this sale is higher, which it usually is, because that figure comes before your deductions: the surtax can then apply even though the taxable income beneath the gain would not suggest it. It changes the surtax and nothing else.
- Cost Basis (required)
-
Unit $ Default 10000 Range 0 to 5000000
About this input
What the asset cost you, adjusted. That is the purchase price plus the commission you paid to buy, plus any reinvested dividends that bought more of it, plus improvements on property, and less any depreciation taken or return of capital received. Getting this wrong is the commonest real error in a capital gains figure, and a broker is not obliged to have reported it at all for anything bought long enough ago. The calculator cannot tell which parcel of shares you sold, so if more than one lot exists the basis entered here has to be the one you identified at the time of the sale.
- Filing Status (required)
-
Default Single Allowed Single, Married filing jointly, Married filing separately, Head of household
About this input
The status on the return. It selects the rate layers, the surtax threshold and the amount of a loss that can be set against ordinary income, and the four differ enough that the same sale can cost noticeably different amounts. A head of household has long-term bands of its own but shares the single filer's surtax threshold, which is the one place the tables do not move together.
- Holding Months (required)
-
Unit months Default 24 Range 0 to 480
About this input
How long you owned the asset before you disposed of it, in whole months. The test is MORE than twelve months, so twelve is short term and thirteen is long, which is why this counts months rather than years. The count runs from the day after you acquired the asset to the day you disposed of it, that day included.
Outputs
- Table1 Gains Column Axis
-
No unit declared
About this output
The values across the top of the tax grid: your other taxable income before the sale, in steps of ten thousand either side of yours and never below nothing. Read a column to hold your income fixed and vary what the sale brought in. The middle entry is your own figure.
- Table1 Gains Column Input
-
Unit currency
About this output
Machinery, and NOT an input. The same for the column axis: Excel substitutes into it while filling the grid, and the rest of the time it mirrors your other taxable income.
- Table1 Gains Corner
-
Unit currency
About this output
Machinery. Excel requires the formula being tabulated to sit in the tax grid's top-left corner, where it means nothing to a reader, so it is formatted away. It holds Total_Tax.
- Ordinary Offset This Year
-
Unit $
About this output
How much of a loss can be set against ordinary income this year: the whole loss if it is small, otherwise the annual limit, which is halved on a separate return. This limit has not changed since 1978 and is not adjusted for inflation. It is zero whenever the sale is a gain.
- Rate Layers
-
No unit declared
About this output
One row for each rate layer the gain actually reaches, with the rate, the dollars landing in that layer and the tax they attract. A long-term gain is measured against the long-term layers and a short-term one against the ordinary income layers, so the rates change with the holding period. Layers the gain never reaches are left out rather than shown as zero, and the rows below the last one used are blank.
- State Tax
-
Unit $
About this output
The flat state rate you entered, applied to the whole gain. It is zero when the rate is left blank. No state's actual rules are modelled, so treat this as a placeholder you can set to whatever your own state works out to rather than as an answer.
- Tax If Long Term
-
Unit $
About this output
What this sale would cost in total if the asset were held more than twelve months: the long-term layers, plus the surtax and the state figure, both of which are the same either way. Compare it with the short-term figure to see what the holding period is worth.
- Tax If Short Term
-
Unit $
About this output
What this sale would cost in total if the asset were held twelve months or less, with the gain taxed as ordinary income. It is usually the larger of the two, but not always: in a narrow band of income the twelve percent ordinary layer sits below the fifteen percent long-term layer, and there a short-term gain is the cheaper one.
- Total Tax
-
Unit $
About this output
The federal tax, the surtax and the state figure added together. This is what the grid at the foot tabulates, and it is the number to compare against what the sale brought in.
- Table1 Gains Row Axis
-
No unit declared
About this output
The values down the left of the tax grid: what the sale brought in, in steps of five thousand either side of yours and never below nothing. Read a row to hold the sale price fixed and vary your other income. The middle entry is your own figure, and a small sale makes the floor repeat near the top of this axis, which is the grid running out of room rather than an error.
- Table1 Gains Row Input
-
Unit currency
About this output
Machinery, and NOT an input. Excel substitutes each value from the row axis into this cell while it fills the grid; the rest of the time it mirrors the sale proceeds. Change the sale proceeds above, never this: the axis is derived from that input, so editing the mirror moves the axis while the grid walks and the grid comes out meaningless.
- Table1 Gains Values
-
Unit currency
About this output
The body of the tax grid: the total tax on the sale, worked out again for every combination of the two axes. One hundred and twenty-one cells, each one the whole calculation run again. It is a component of the grid rather than a result on its own.
- NIIT
-
Unit $
About this output
The net investment income tax on the gain: 3.8 percent of the smaller of the gain and the amount by which your modified adjusted gross income including the gain exceeds the threshold for your filing status. Because it takes the smaller of the two, a large gain on a modest income is only partly caught by it. The thresholds have not been adjusted for inflation since they were introduced, so more people meet them every year.
- Gain
-
Unit $
About this output
What the sale brought in less what the asset cost you. A negative figure is a loss, which this calculator answers rather than refuses: there is no tax on it, and what it can offset is reported below.
- Gain At 0 Percent
-
Unit $
About this output
How many dollars of the gain fall in the zero percent long-term layer, which is the part of the gain that sits below the threshold once your other income has filled the stack beneath it. It is computed whether or not the sale qualifies as long term, so for a short-term sale it shows what the split would be if the asset were held past twelve months.
- Gain At 15 Percent
-
Unit $
About this output
How many dollars of the gain fall in the fifteen percent long-term layer. Most gains for most households land wholly in this one, which is why a flat fifteen percent is the usual rule of thumb and why the rule of thumb is wrong exactly at the two edges.
- After Tax Proceeds
-
Unit $
About this output
What the sale brought in, less all the tax reported here. It is not the profit: the money you originally put in is part of the proceeds and was never taxable, so compare this with what the sale brought in rather than with the gain.
- Effective Rate On Gain
-
Unit fraction
About this output
The total tax divided by the gain. It is almost always below the rate on the next dollar, because the first part of a long-term gain can land in a lower layer than the last part, and it is the honest answer to the question of what this sale cost you as a rate.
- Federal Tax
-
Unit $
About this output
The federal income tax on this gain alone, worked out by laying the gain on top of your other taxable income and charging each layer it reaches at that layer's own rate. It does not include the net investment income tax, which is a separate charge reported beside it.
- Marginal Rate On Gain
-
Unit fraction
About this output
The rate a further dollar of gain would be charged at: the rate of the highest layer the gain already reaches, plus the surtax where it applies and plus your state rate. It is what to use when deciding whether to sell a little more this year or wait, and it is not the rate the sale as a whole was charged at.
- Model Status
-
No unit declared
About this output
Reads OK, or explains why the inputs are not valid or why the answer deserves a second look.
- Months To Long Term
-
Unit months
About this output
How many more whole months the asset would have to be held for the gain to be long term. Zero once it already is. Because the control moves in whole months and the test is more than twelve, a sale at twelve months reads one month rather than none.
- Gain At 20 Percent
-
Unit $
About this output
How many dollars of the gain fall in the twenty percent long-term layer, the part above the upper threshold for your filing status. With the surtax on top, that part is charged at 23.8 percent.
- Holding Period
-
No unit declared
About this output
How the gain is treated: long term when the asset was held more than twelve months, short term otherwise, and simply a loss when the sale brought in less than the basis. The treatment decides which set of rate layers the gain is walked through, and the two figures further down price the sale both ways so the difference can be seen.
- Loss Carryforward
-
Unit $
About this output
The part of a loss that is left after this year's offset. It carries forward with no time limit and keeps its character, so it can offset gains in a later year before it is used against ordinary income again. This calculator prices one sale, so it does not net the loss against other gains you may have in the same year, which a return does first.
LogicCommons is in beta. If a result, label, or reference looks wrong, tell us here; we read every message.
Methodology
Purpose and model boundary
Use this to price the federal tax on one sale. The gain is laid on top of the other income you are taxed on and then walked through the rate layers it reaches, so a gain that straddles two layers is charged as two pieces rather than at one flat rate. The surtax on investment income is worked out beside it, and a single flat state rate can be added as a stand-in.
It prices ONE sale. It does not net that sale against other gains or losses you may have in the same year, which a return does first, and it does not know which parcel of shares you sold, so the cost you enter has to be the one you identified at the time. Alternative minimum tax, collectibles, qualified small business stock, the treatment of a home sale and the recapture of depreciation on property are all outside it.
Inputs and units
| Input | Unit | Accepted range | What it means |
|---|---|---|---|
| Sale Proceeds | $ | 0 through 5,000,000 | What the sale brought in, after the commission or fee the broker took out of it. It is the gross figure and not the profit: the profit is worked out here by taking the cost off it. |
| Cost Basis | $ | 0 through 5,000,000 | What the asset cost you, adjusted: the purchase price plus the buying commission, plus reinvested dividends that bought more of it, plus improvements on property, less any depreciation taken or capital returned. This is the commonest real error in a capital gains figure, and a broker is not obliged to have reported it at all for something bought long enough ago. |
| Holding Months | months | 0 through 480 | How long you owned the asset before disposing of it, in whole months. The test is MORE than twelve, so twelve is short term and thirteen is long, which is why this counts months rather than years. The count runs from the day after you acquired it to the day you disposed of it, that day included. |
| Filing Status | list | Single, married filing jointly, married filing separately, head of household | The status on the return. It selects the rate layers, the surtax threshold and how much of a loss can be set against ordinary income. A head of household has long-term bands of its own but shares the single filer's surtax threshold, which is the one place the two tables do not move together. |
| Other Taxable Income | $ | 0 through 2,000,000 | Everything else you are taxed on this year, after your deductions and before this sale. It is taxable income rather than gross pay, and the difference matters more here than anywhere else: the gain is laid on top of it, so a gross number puts the gain in a higher layer than it belongs in and overstates the tax. |
| MAGI Before Sale | $ | 0 through 2,000,000 | Optional. The surtax keys off a different figure from the rate layers. Left blank, the surtax is measured against your other taxable income, which is right when the two agree. Fill it when your modified adjusted gross income before this sale is higher, which it usually is, because that figure comes before your deductions. It changes the surtax and nothing else. |
| State Rate | % | 0% through 13.3% | Optional. A single flat percentage applied to the whole gain, and a stand-in rather than any state's rules. Leave it blank where there is no state tax on the gain. It is one rate because states differ in kind and not only in rate: some exclude part of a long-term gain, some tax it as ordinary income, some add a surcharge above a threshold. |
Governing relationships
The gain is what the sale brought in less what the asset cost you. A negative figure is a loss, which this calculator answers rather than refuses.
The holding period decides the treatment. More than twelve months is long term and the gain is walked through the long-term layers; twelve months or less is short term and the gain is walked through the ordinary income layers instead.
Whichever set applies, the layers are filled from the bottom. Your other taxable income occupies the stack first, and the gain sits on what is left, so the first dollars of the gain can be charged at a lower rate than the last ones. Each layer the gain reaches is charged at that layer's own rate and the pieces are added.
The surtax on investment income is charged at a fixed rate on the SMALLER of the gain and the amount by which your modified adjusted gross income including the gain exceeds the threshold for your filing status. Because it takes the smaller of the two, a large gain on a modest income is only partly caught by it.
The state figure is the flat rate you entered applied to the whole gain, and it is added last.
Calculation sequence
This is the order in which the reported figures depend on one another, each step traceable to what the calculator says a figure is built from. It is not a claim about the order in which the model evaluates itself.
- Take the cost off what the sale brought in to get the gain, and read the holding period from the months entered.
- Fill the rate layers with your other taxable income, so the gain has a known starting height.
- Walk the gain through the layers above that height, splitting it into the piece falling in each layer and charging each piece at that layer's rate.
- Work out the surtax on the smaller of the gain and the income above the threshold.
- Apply the flat state rate to the whole gain.
- Add the three together, take the total off what the sale brought in, and divide the total by the gain to get the rate the sale really cost.
- Price the same sale under the other holding period, so the two treatments can be compared.
- Rerun the whole calculation across a grid of sale prices and other incomes, so the sensitivity to each is visible rather than asserted.
Outputs and interpretation
| Output | Role | Unit | What it means |
|---|---|---|---|
| Total Tax | primary | $ | The federal tax on the gain, the surtax and the state figure added together. This is the number to set against what the sale brought in. |
| After Tax Proceeds | primary | $ | What the sale brought in, less all the tax reported here. It is not the profit: the money you originally put in is part of the proceeds and was never taxable, so compare it with what the sale brought in rather than with the gain. |
| Effective Rate On Gain | primary | % | The total tax divided by the gain. It is almost always below the rate on the next dollar, because the first part of a long-term gain can land in a lower layer than the last part. |
| Gain | detail | $ | What the sale brought in less what the asset cost you. Negative means a loss. |
| Holding Period | detail | text | Long term, short term, or simply a loss. The treatment decides which set of rate layers the gain is walked through. |
| Months To Long Term | detail | months | How many more whole months the asset would have to be held for the gain to be long term. Because the control moves in whole months and the test is more than twelve, a sale at twelve months reads one month rather than none. |
| Federal Tax | detail | $ | The federal income tax on this gain alone. It does not include the surtax, which is reported beside it. |
| NIIT | detail | $ | The surtax on investment income, charged on the smaller of the gain and the income above the threshold for your filing status. The thresholds are not adjusted for inflation, so more people meet them every year. |
| State Tax | detail | $ | The flat rate you entered applied to the whole gain, and nothing more. Treat it as a placeholder you can set to whatever your own state works out to. |
| Gain At 0 Percent | detail | $ | How much of the gain falls in the lowest long-term layer. It is worked out whether or not the sale qualifies as long term, so for a short-term sale it shows what the split would be if the asset were held past twelve months. |
| Gain At 15 Percent | detail | $ | How much of the gain falls in the middle long-term layer. Most gains for most households land wholly in this one, which is why a single flat rate is the usual rule of thumb and why the rule of thumb is wrong exactly at the two edges. |
| Gain At 20 Percent | detail | $ | How much of the gain falls in the top long-term layer. With the surtax on top, that part carries the highest combined rate this calculator can report. |
| Marginal Rate On Gain | detail | % | The rate a further dollar of gain would be charged at: the highest layer the gain already reaches, plus the surtax where it applies and plus your state rate. It is what to use when deciding whether to sell a little more this year or wait. |
| Tax If Long Term | detail | $ | What this sale would cost in total if the asset were held more than twelve months. |
| Tax If Short Term | detail | $ | What this sale would cost in total if it were held twelve months or less. It is usually the larger of the two, but not always: in a narrow band of income the twelve percent ordinary layer sits below the fifteen percent long-term one. |
| Ordinary Offset This Year | detail | $ | How much of a loss can be set against ordinary income this year: the whole loss if it is small, otherwise the annual limit, halved on a separate return. The limit is not adjusted for inflation. It reads nothing whenever the sale is a gain. |
| Loss Carryforward | detail | $ | The part of a loss left after this year's offset. It carries forward with no time limit and keeps its character. |
| Rate Layers | detail | table | One row for each rate layer the gain actually reaches, with the rate, the dollars landing in that layer and the tax they attract. Layers the gain never reaches are left out rather than shown as nothing. |
Model Status reads OK, or explains why the inputs are not valid or why the answer deserves a second look before you act on it. It is shown alongside the results rather than in place of them.
The calculator also returns a grid that reruns the whole calculation across a range of sale prices and other incomes at once. Its axes, corner and body arrive as separate values and are the grid's parts rather than results to read on their own; the page assembles them into the table.
Every figure above is returned by the model. The page arranges and formats them; it computes none of them.
Validation and status logic
These are the states the delivery's own recorded runs exercise, so the table records what this calculator has been observed to return rather than every branch it could take.
| Condition | Returned status |
|---|---|
| What the sale brought in was entered as a negative amount | NOT VALID: the sale proceeds cannot be less than nothing; enter what the sale brought in as a positive amount |
| The income including the gain is above the surtax threshold | CHECK: the net investment income tax applies at this income, so the gain carries that surtax on top of its own rate |
| The asset was held twelve months or less, and long-term treatment is within six months | CHECK: this gain is short term and is within six months of qualifying as long term; the figures below show what it would cost under each treatment |
| The sale brought in less than the asset cost | CHECK: this sale is a loss, so there is no tax on it; the offset against ordinary income and the amount carried forward are shown below |
| None of the preceding conditions applies | OK |
Assumptions and limitations
- One sale, priced on its own. A return nets every gain and loss for the year before applying the rates, so a household with other sales will not match this figure.
- The layers, thresholds and limits are those of a single tax year as delivered. They move most years, and a figure from a different year will not reproduce.
- The state figure is one flat rate on the whole gain. No state's actual rules are modelled, and several states do not tax the gain at all.
- The surtax is worked out on this gain alone. Other investment income you hold counts towards the same threshold on a real return and is not entered here.
- Collectibles, qualified small business stock, depreciation recapture on property, the exclusion on a main home and the alternative minimum tax are all outside the model.
- The cost you enter is taken as correct. Nothing here can check it, and it is the single input most likely to be wrong.
Restrictions and non-computing states
This calculator enforces the numeric limits recorded above before any figure is worked out, so a value outside them is refused rather than answered.
A sale that brought in less than the asset cost is a loss, and the model answers it: there is no tax, and what the loss can offset this year and what carries forward are reported instead. That is a result rather than a refusal.
Errors and warnings
NOT VALID means the inputs do not describe a question this calculator can answer, and the figures beside it should not be relied on. CHECK is not an error: the arithmetic is sound and the figures stand, but something about the combination is worth knowing first, such as a surtax that applies at this income or a holding period only a few months short of the better treatment. The status is shown with the results rather than in place of them, so a flagged answer is still a readable one.
A value the page itself refuses, because it falls outside the limits above, is rejected before the calculation is requested and no figures are returned at all. That is different again from a transport or service failure, where the page reports that the result could not be fetched rather than showing a stale or partial one.
References
The rule that decides which set of rate layers a gain is walked through is the holding period, and the Internal Revenue Service states it in one sentence: "Generally, if you hold the asset for more than one year before you dispose of it, your capital gain or loss is long-term. If you hold it one year or less, your capital gain or loss is short-term." The same page gives the three long-term rates this calculator splits a gain across, and the limit on setting a net loss against ordinary income, which it puts at "the lesser of $3,000 ($1,500 if married filing separately)" with the remainder carried forward. See Topic no. 409, Capital gains and losses.
The surtax reported beside the federal figure is the net investment income tax. The Service describes it as "A 3.8 percent net investment income tax (NIIT) applies to individuals, estates, and trusts that have net investment income above applicable threshold amounts", charged on income including "net gains from the disposition of property such as stocks, bonds, mutual funds, and real estate" and not on wages or on income from an active business. The thresholds are stated by filing status. See Topic no. 559, Net investment income tax.
Neither page tells you what any particular sale costs, and neither is a substitute for the figures on your own broker statement. The cost you enter is the one input nothing here can check, and it is where a wrong answer most often starts.
These sources provide background; they do not supply the calculator's assumptions or certify its result. This calculator is informational and is not financial, investment, or tax advice. Results follow directly from the sale price, the cost and the income you enter, and one sale priced on its own is not the same question as a whole year's return.
Found a problem, or have an idea?
Tell us if a result looks wrong, a label is unclear, or something is missing. We read every message.