Short vs long-term capital gains calculator
On a 20,000 gain, a 32% short-term rate means 6,400 of tax and a 15% long-term rate means 3,000, so waiting for the long-term rate saves 3,400. Enter your gain and both rates to compare. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Gain
- 20,000
- Short rate
- 32
- Long rate
- 15
- Short term tax
- 6,400
- Long term tax
- 3,000
- Tax savings
- 3,400
- Rate spread
- 17
Selling an appreciated asset can look like a single number — the realized gain — until you ask which tax schedule will apply. A short-term gain is typically taxed at ordinary income rates, the same brackets that apply to wages. A long-term gain, after a qualifying holding period, is usually taxed at a lower preferential capital-gains rate. The difference is not a rounding error: on a twenty-thousand-unit gain the gap between a thirty-two percent ordinary rate and a fifteen percent long-term rate is thousands of units of tax, and the after-tax proceeds change by the same amount. This short versus long-term capital gains calculator accepts a realized gain and the two rates, then returns both tax bills, the savings from qualifying for the long-term rate, the after-tax remainder under each treatment, and which schedule is cheaper.
What short-term versus long-term tax on a gain actually compares
A capital gain is the excess of sale proceeds over cost basis. How that gain is taxed depends on holding period in most systems that distinguish short-term from long-term treatment. Short-term gains are usually stacked on top of ordinary income and taxed at the same marginal rates as wages, bonuses, or interest.
Long-term gains, after a qualifying hold — commonly more than one year in the United States, though the threshold is a legal fact you supply through the rates, not a date this calculator invents — are often taxed at a lower preferential schedule. Searchers who type short versus long term capital gains calculator are not asking this tool to classify a lot by calendar days. They already know, or are modeling, two candidate rates, and they want the cash gap.
The arithmetic is elementary and must stay elementary: short-term tax equals gain times the short-term ordinary rate divided by one hundred; long-term tax equals gain times the long-term rate divided by one hundred; tax savings equal the short-term bill minus the long-term bill. A positive savings figure means waiting for, or qualifying under, the long-term schedule reduces tax on this gain. A negative figure, which appears only if you enter a long-term rate higher than the ordinary rate, means the short-term schedule is cheaper.
Equal rates produce equal bills and a preferred value of same.
When comparing both tax treatments pays off
Households and advisors use a short versus long-term capital gains calculator when they already know the two rates that would apply and need the cash difference before they decide whether to wait out a holding-period threshold, harvest a lot this year, or gift the position. Exam-prep and personal-finance courses need a deterministic oracle that rejects a non-positive gain instead of inventing a refund. Spreadsheet authors who currently copy a pair of multiplications into every workbook can call one contract and pin the rounded fields in tests.
Invalid input does not consume balance.
What you can do with it
Hold-or-sell planning before a threshold
Compare the ordinary-rate bill against the preferential long-term bill on the same realized gain before you decide whether waiting is worth the cash savings.
Advisor memos and client illustrations
Paste both tax amounts, the savings, and the after-tax remainders into a planning note without re-deriving the two multiplications in a spreadsheet.
FAQ
How does the short vs long-term capital gains calculator work?
Send a realized gain plus two percent rates. The response also returns the savings, after-tax remainders, and which schedule is cheaper.
How much do I save if my gain is taxed at the long-term rate?
On a 20,000 gain, the 32% short-term rate gives 6,400 of tax and the 15% long-term rate gives 3,000. The 3,400 difference is your saving, and you keep 17,000 after tax instead of 13,600.
Do I enter sale proceeds and cost basis, or the gain itself?
Enter the gain already worked out, which is sale proceeds minus cost basis. The calculator then applies each of the two rates you give to that same gain.
Does the calculator decide whether my sale is short- or long-term?
No. It does not count days held or check a holding-period rule. You enter the two rates that could apply, for example where long-term means more than one year, and it compares the tax under each.
What does a negative saving mean?
That you entered a long-term rate higher than the short-term one, so the short-term treatment is cheaper for this gain. With equal rates, both bills match and neither treatment is preferred.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/finance/capital-gains-short-vs-long \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"gain":20000,"short_rate":32,"long_rate":15}'const res = await fetch("https://api.kit.forhosting.com/finance/capital-gains-short-vs-long", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"gain": 20000,
"short_rate": 32,
"long_rate": 15
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/finance/capital-gains-short-vs-long",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"gain": 20000,
"short_rate": 32,
"long_rate": 15
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/finance/capital-gains-short-vs-long", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"gain":20000,"short_rate":32,"long_rate":15}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"gain":20000,"short_rate":32,"long_rate":15}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/finance/capital-gains-short-vs-long", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"gain": 20000,
"short_rate": 32,
"long_rate": 15
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "finance.capital_gains_short_vs_long",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
What short-term versus long-term tax on a gain actually compares
The endpoint also returns after-tax remainders under each treatment and the rate spread in percentage points, so a planner can paste one JSON object into a memo without re-deriving net proceeds by hand.
Input contract, response fields, and how validation fails
The gain must be strictly greater than zero: this calculator compares tax on a gain, not the treatment of a capital loss, so a zero or negative gain is rejected rather than silently returning zero tax. Both rates must lie between zero and one hundred inclusive; a rate outside that closed interval is not a percent this contract will apply. Failed validation is not billed. POST a JSON body with three required finite numbers: gain, the realized capital gain in whatever currency units you already use; short_rate, the ordinary or short-term rate as a percent such as thirty-two for thirty-two percent; and long_rate, the long-term capital gains rate as a percent such as fifteen. Each field may arrive as a JSON number or as a numeric string. Missing fields, empty strings, and non-finite values fail with invalid_input naming the canonical field. Aliases are accepted for convenience: amount for gain, st_rate or ordinary_rate for short_rate, and lt_rate or ltcg_rate for long_rate. On success the body echoes the three inputs rounded half-up to two decimal places, then returns short_term_tax, long_term_tax, tax_savings, rate_spread, net_after_short, net_after_long, preferred (long_term, short_term, or same), a formula string, and method capital_gains_short_vs_long. When the short-term tax is not zero the body also includes savings_percent, the savings as a percent of the short-term bill; that optional field is omitted rather than set to null when the short-term rate is zero and the ratio would be undefined. Worked example: a gain of twenty thousand at a thirty-two percent short-term rate and a fifteen percent long-term rate yields six thousand four hundred of short-term tax, three thousand of long-term tax, three thousand four hundred of savings, and a preferred value of long_term.
Where a short-versus-long comparison endpoint earns its keep
Content sites that rank for the long-tail query short vs long term capital gains calculator benefit from a focused landing whose free browser path matches the prepaid API path byte-for-byte on the same pure module, distinct from a general capital-gains estimator that classifies a lot by holding days and returns a single bill.
Integration use cases
Deterministic fixtures for finance lessons
Mark short-versus-long homework items with a pure oracle that rejects a non-positive gain and never invents a refund.
Technical questions
Do I enter proceeds and cost basis, or the gain itself?
Enter the realized gain (proceeds minus cost basis) as gain, or the alias amount. This landing compares two rates on a known gain; it does not classify a lot by holding days.
What happens if the gain is zero or negative?
The task fails with invalid_input. This calculator compares tax owed on a capital gain, so a zero or negative figure is rejected instead of returning a silent zero bill.
Can the long-term rate be higher than the short-term rate?
Yes. The engine does not force long_rate below short_rate. If you enter that unusual pair, preferred is short_term and tax_savings is negative.
What does the short vs long-term capital gains calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed. This is an estimate you control, not tax advice.