How it works
Capital gain (or loss) is the difference between your sale proceeds and your cost basis. Cost basis typically includes the purchase price plus certain transaction costs such as commissions or fees; sale proceeds are what you receive from the sale before taxes but after normal selling commissions.
If the result of sale proceeds − cost basis is positive, you have a gain. If it is negative, you have a capital loss. This calculator reports both possibilities so you can see whether you are realizing a gain or harvesting a loss.
The holding period determines whether the gain is treated as short‑term or long‑term. In a simplified model like this one, we treat 12 or more months as long‑term and anything less than 12 months as short‑term.
You provide your estimated long‑term capital gains rate (often 0%, 15%, or 20% at the federal level in the U.S.) and your short‑term rate (generally your marginal ordinary income rate, such as 22%, 24%, or 32%).
When the gain is positive, the calculator checks your holding period. If holdingMonths is 12 or more, it applies the long‑term rate you entered. If it is less than 12, it applies the short‑term rate. For losses or zero gains, estimated tax is shown as zero in this simplified model.
The effective rate is computed as Estimated tax ÷ Positive gain, expressed as a percentage, so you can see how much of the gain you are giving up in taxes under your assumptions.
Because real‑world tax systems include brackets, surcharges, and special rules (like the Net Investment Income Tax or state taxes), this tool focuses on a single blended rate that you supply rather than computing the entire tax return.
Formula
Let B = Cost basis, P = Sale proceeds.\nGain = P − B.\nIf Gain ≤ 0: Tax = 0 (loss not monetized here).\nIf Gain > 0 and HoldingMonths ≥ 12: Tax = Gain × (Long‑term rate ÷ 100).\nIf Gain > 0 and HoldingMonths < 12: Tax = Gain × (Short‑term rate ÷ 100).\nEffective rate (if Gain > 0) = Tax ÷ Gain.