Single
Married Filing Jointly
Married Filing Separately
Head of Household
Your Estimated Capital Gains Tax:
—
Tax Rate: —
Understanding Federal Capital Gains Tax
Capital gains tax is a tax on the profit you make from selling an asset that has increased in value. This applies to assets like stocks, bonds, real estate, cryptocurrencies, and collectibles. The profit is known as the 'capital gain'. When you sell an asset for less than you paid for it, you incur a 'capital loss', which may offer tax benefits.
Short-Term vs. Long-Term Capital Gains
The tax rate you pay depends on how long you owned the asset before selling it. The IRS distinguishes between two types of capital gains:
Short-Term Capital Gains: These are gains from assets held for one year or less. They are taxed at your ordinary income tax rates, which can be significantly higher than long-term rates.
Long-Term Capital Gains: These are gains from assets held for more than one year. They are taxed at preferential rates, which are generally lower than ordinary income tax rates. The rates depend on your overall taxable income and filing status.
2023-2024 Long-Term Capital Gains Tax Rates
For assets held longer than one year, the long-term capital gains tax rates for 2023 (filed in 2024) and expected for 2024 are typically 0%, 15%, or 20%. These rates depend on your taxable income and your filing status. The thresholds are adjusted annually for inflation.
General Tax Rate Thresholds (for 2023, filed in 2024 – subject to change):
Single Filers:
0%: Taxable income up to $44,625
15%: Taxable income from $44,625 to $492,300
20%: Taxable income over $492,300
Married Filing Jointly:
0%: Taxable income up to $89,250
15%: Taxable income from $89,250 to $553,850
20%: Taxable income over $553,850
Note: Thresholds for other filing statuses (Married Filing Separately, Head of Household) and for different tax years may vary. Collectibles and certain other assets may be taxed at higher rates. This calculator uses common long-term rates and single/married jointly thresholds for simplicity. Always consult a tax professional for personalized advice.
How This Calculator Works
Calculate Capital Gain: The calculator first determines the capital gain by subtracting the Original Cost Basis (what you paid for the asset) from the Sale Price. If the sale price is lower, it's a capital loss, and the tax is $0 (though losses have other implications).
Determine Holding Period: It checks if the asset was held for more than one year (long-term) or one year or less (short-term).
Apply Tax Rate:
If it's a short-term gain, the gain is added to your ordinary taxable income, and the tax is calculated based on your marginal income tax bracket. This calculator simplifies by assuming the gain falls within the provided taxable income bracket.
If it's a long-term gain, the calculator determines the applicable rate (0%, 15%, or 20%) based on your total taxable income, filing status, and the current IRS thresholds.
Display Result: The estimated capital gains tax is displayed.
Use Cases
This calculator is useful for:
Estimating the tax liability when selling stocks, bonds, or other investments.
Planning for future sales of assets to understand potential tax implications.
Comparing the tax impact of holding an asset short-term versus long-term.
Understanding how different income levels and filing statuses affect capital gains tax.
Disclaimer: This calculator is for educational and estimation purposes only. Tax laws are complex and subject to change. The calculation is based on provided inputs and general 2023/2024 IRS long-term capital gains tax thresholds for single and married filing jointly filers. It does not account for all possible deductions, credits, state taxes, or specific asset types (like collectibles). Consult with a qualified tax professional or CPA for advice tailored to your specific financial situation.
function calculateCapitalGainsTax() {
var assetCost = parseFloat(document.getElementById("assetCost").value);
var assetSalePrice = parseFloat(document.getElementById("assetSalePrice").value);
var holdingPeriod = parseFloat(document.getElementById("holdingPeriod").value);
var taxableIncome = parseFloat(document.getElementById("taxableIncome").value);
var filingStatus = document.getElementById("filingStatus").value;
var resultDiv = document.getElementById("result");
var taxRateUsedDiv = document.getElementById("taxRateUsed");
resultDiv.style.color = '#dc3545'; // Default to red for errors/no tax
taxRateUsedDiv.style.color = '#666';
// Input validation
if (isNaN(assetCost) || isNaN(assetSalePrice) || isNaN(holdingPeriod) || isNaN(taxableIncome)) {
resultDiv.textContent = "Please enter valid numbers for all fields.";
return;
}
if (assetCost <= 0 || assetSalePrice <= 0 || holdingPeriod < 0 || taxableIncome < 0) {
resultDiv.textContent = "Inputs must be positive values (holding period can be 0).";
return;
}
var capitalGain = assetSalePrice – assetCost;
var estimatedTax = 0;
var taxRate = 0;
if (capitalGain <= 0) {
resultDiv.textContent = "$0.00";
taxRateUsedDiv.textContent = "No capital gain realized.";
resultDiv.style.color = '#28a745'; // Green for zero tax
return;
}
if (holdingPeriod 492300) shortTermRate = 0.37; // 37%
else if (taxableIncome + capitalGain > 190750) shortTermRate = 0.35; // 35%
else if (taxableIncome + capitalGain > 89450) shortTermRate = 0.32; // 32%
else if (taxableIncome + capitalGain > 46300) shortTermRate = 0.24; // 24%
else if (taxableIncome + capitalGain > 11600) shortTermRate = 0.22; // 22%
else if (taxableIncome + capitalGain > 0) shortTermRate = 0.12; // 12%
else shortTermRate = 0.10; // 10%
} else if (filingStatus === "married_jointly") {
if (taxableIncome + capitalGain > 731200) shortTermRate = 0.37; // 37%
else if (taxableIncome + capitalGain > 609350) shortTermRate = 0.35; // 35%
else if (taxableIncome + capitalGain > 523600) shortTermRate = 0.32; // 32%
else if (taxableIncome + capitalGain > 178100) shortTermRate = 0.24; // 24%
else if (taxableIncome + capitalGain > 89450) shortTermRate = 0.22; // 22%
else if (taxableIncome + capitalGain > 23200) shortTermRate = 0.12; // 12%
else shortTermRate = 0.10; // 10%
} else if (filingStatus === "married_separately") {
if (taxableIncome + capitalGain > 365600) shortTermRate = 0.37; // 37%
else if (taxableIncome + capitalGain > 304675) shortTermRate = 0.35; // 35%
else if (taxableIncome + capitalGain > 261800) shortTermRate = 0.32; // 32%
else if (taxableIncome + capitalGain > 94175) shortTermRate = 0.24; // 24%
else if (taxableIncome + capitalGain > 49725) shortTermRate = 0.22; // 22%
else if (taxableIncome + capitalGain > 11600) shortTermRate = 0.12; // 12%
else shortTermRate = 0.10; // 10%
} else if (filingStatus === "head_of_household") {
if (taxableIncome + capitalGain > 693750) shortTermRate = 0.37; // 37%
else if (taxableIncome + capitalGain > 553100) shortTermRate = 0.35; // 35%
else if (taxableIncome + capitalGain > 492300) shortTermRate = 0.32; // 32%
else if (taxableIncome + capitalGain > 134500) shortTermRate = 0.24; // 24%
else if (taxableIncome + capitalGain > 63450) shortTermRate = 0.22; // 22%
else if (taxableIncome + capitalGain > 17400) shortTermRate = 0.12; // 12%
else shortTermRate = 0.10; // 10%
}
taxRate = shortTermRate;
estimatedTax = capitalGain * taxRate;
taxRateUsedDiv.textContent = "Tax Rate: Short-Term (Ordinary Income Rate) – Approx. " + (taxRate * 100).toFixed(1) + "%";
} else {
// Long-term capital gains
var threshold0_single = 47025; // For 2024, estimated
var threshold15_single = 518900; // For 2024, estimated
var threshold0_married_jointly = 94050; // For 2024, estimated
var threshold15_married_jointly = 583750; // For 2024, estimated
var threshold0_married_separately = 47025; // For 2024, estimated
var threshold15_married_separately = 291875; // For 2024, estimated
var threshold0_head_of_household = 62700; // For 2024, estimated
var threshold15_head_of_household = 553850; // For 2024, estimated
var incomeForRateCheck = taxableIncome; // Use reported taxable income to determine bracket
// The *gain* itself might push income into higher brackets,
// but we use the base income to determine the *rate* for the gain.
// This is a simplification; a more precise calculation involves segmenting the gain.
if (filingStatus === "single") {
if (incomeForRateCheck <= threshold0_single) {
taxRate = 0.00;
} else if (incomeForRateCheck <= threshold15_single) {
taxRate = 0.15;
} else {
taxRate = 0.20;
}
} else if (filingStatus === "married_jointly") {
if (incomeForRateCheck <= threshold0_married_jointly) {
taxRate = 0.00;
} else if (incomeForRateCheck <= threshold15_married_jointly) {
taxRate = 0.15;
} else {
taxRate = 0.20;
}
} else if (filingStatus === "married_separately") {
if (incomeForRateCheck <= threshold0_married_separately) {
taxRate = 0.00;
} else if (incomeForRateCheck <= threshold15_married_separately) {
taxRate = 0.15;
} else {
taxRate = 0.20;
}
} else if (filingStatus === "head_of_household") {
if (incomeForRateCheck <= threshold0_head_of_household) {
taxRate = 0.00;
} else if (incomeForRateCheck 0) {
resultDiv.style.color = '#28a745'; // Green for positive tax
} else {
resultDiv.style.color = '#6c757d'; // Gray for zero tax
}
resultDiv.textContent = "$" + estimatedTax.toFixed(2);
}