Calculators
Capital gains tax (long & short term) API
Estimate capital-gains tax: long-term gains via the US 2024 0/15/20 federal schedule stacked above ordinary taxable income, or short-term gains at the ordinary marginal rate, returning tax, after-tax gain, effective rate, and a per-rate-band breakdown. Estimate only; excludes 3.8% NIIT and state. Answers 'tax on a $50k long-term gain','short vs long-term capital gains tax','what rate on my stock sale','crypto capital gains tax'.
Price$0.01per request
MethodPOST
Route/v1/calc/tax-capital-gains
StatusLive
MIME typeapplication/json
Rate limit120/minute
CacheNo cache
taxcapital-gainsltcgshort-terminvestingstockscryptocalc
API URL
Integration docshttps://x402.hexl.dev/v1/calc/tax-capital-gainsExample request
{
"gain": 50000,
"ordinaryTaxableIncome": 50000,
"filingStatus": "single",
"term": "long"
}Example response
{
"year": 2024,
"filingStatus": "single",
"gain": 50000,
"term": "long",
"ordinaryTaxableIncome": 50000,
"tax": 7500,
"afterTaxGain": 42500,
"effectiveRate": 0.15,
"effectivePercent": 15,
"rateBreakdown": [
{
"rate": 0.15,
"amount": 50000,
"tax": 7500
}
],
"note": "Estimate. US LTCG 0/15/20 schedule, stacked above ordinary taxable income; excludes 3.8% NIIT and state tax."
}Input schema
{
"type": "object",
"required": [
"gain"
],
"properties": {
"gain": {
"type": "number",
"description": "Capital gain in USD",
"examples": [
50000
]
},
"ordinaryTaxableIncome": {
"type": "number",
"description": "Ordinary taxable income the gain stacks on",
"examples": [
50000
]
},
"filingStatus": {
"type": "string",
"enum": [
"single",
"married",
"head"
],
"examples": [
"single"
]
},
"term": {
"type": "string",
"enum": [
"long",
"short"
],
"examples": [
"long"
]
},
"holdingDays": {
"type": "number",
"description": "Days held; >365 = long-term"
},
"ordinaryMarginalRate": {
"type": "number",
"description": "Decimal marginal rate for short-term, e.g. 0.24"
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}