Use this calculator to estimate your potential tax liability when selling assets such as stocks, real estate, or business interests. It calculates both Long-Term and Short-Term capital gains tax based on 2024 US tax brackets.
Single
Married Filing Jointly
Head of Household
More than 1 year (Long-Term)
1 year or less (Short-Term)
Total Capital Gain:$0.00
Estimated Tax Rate:0%
Estimated Tax Owed:$0.00
Net Profit After Tax:$0.00
Understanding Capital Gains Tax
Capital gains tax is a levy on the profit realized on the sale of a non-inventory asset. The most common capital gains are realized from the sale of stocks, bonds, precious metals, real estate, and property.
Short-Term vs. Long-Term
The duration you hold the asset significantly impacts your tax rate:
Short-Term Capital Gains: Applies to assets held for one year or less. These are taxed as ordinary income, meaning they are subject to your regular income tax bracket, which can be as high as 37%.
Long-Term Capital Gains: Applies to assets held for more than one year. These benefit from preferential tax rates of 0%, 15%, or 20%, depending on your income level.
2024 Long-Term Capital Gains Tax Brackets
The tax rate you pay depends on your filing status and total taxable income. Below are the thresholds for the 2024 tax year:
Rate
Single
Married Filing Jointly
Head of Household
0%
Up to $47,025
Up to $94,050
Up to $63,000
15%
$47,026 – $518,900
$94,051 – $583,750
$63,001 – $551,350
20%
Over $518,900
Over $583,750
Over $551,350
How to Calculate Your Tax
To calculate your estimated capital gains tax manually:
Determine your basis: Start with the original purchase price and add any purchase fees.
Determine your realized amount: Take the sale price and subtract selling expenses (commissions, fees).
Calculate the gain: Realized Amount – Basis.
Apply the rate: Depending on your holding period and total taxable income (including the gain), apply the appropriate percentage to the gain amount.
Net Investment Income Tax (NIIT)
High earners may be subject to an additional 3.8% Net Investment Income Tax. This generally applies if your modified adjusted gross income exceeds $200,000 for singles or $250,000 for married couples filing jointly. This calculator focuses on the standard federal capital gains brackets.
function calculateCapitalGains() {
// 1. Get input values
var purchasePrice = parseFloat(document.getElementById('purchasePrice').value);
var salePrice = parseFloat(document.getElementById('salePrice').value);
var sellingCosts = parseFloat(document.getElementById('sellingCosts').value);
var annualIncome = parseFloat(document.getElementById('annualIncome').value);
var filingStatus = document.getElementById('filingStatus').value;
var duration = document.getElementById('ownershipDuration').value;
// 2. Validate inputs
if (isNaN(purchasePrice) || isNaN(salePrice) || isNaN(annualIncome)) {
alert("Please enter valid numbers for prices and income.");
return;
}
if (isNaN(sellingCosts)) sellingCosts = 0;
// 3. Basic Calculations
var netSaleProceeds = salePrice – sellingCosts;
var totalGain = netSaleProceeds – purchasePrice;
// Setup results elements
var displayGain = document.getElementById('displayGain');
var displayRate = document.getElementById('displayRate');
var displayTax = document.getElementById('displayTax');
var displayNet = document.getElementById('displayNet');
var resultsArea = document.getElementById('results-area');
// Handle Loss scenario
if (totalGain 0) {
taxAmount += (gainRemaining * 0.20);
}
}
// 5. Update UI
effectiveRate = (taxAmount / totalGain) * 100;
var netProfit = totalGain – taxAmount;
resultsArea.style.display = 'block';
displayGain.innerHTML = "$" + totalGain.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
displayRate.innerHTML = effectiveRate.toFixed(1) + "% (Effective)";
displayTax.innerHTML = "$" + taxAmount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
displayNet.innerHTML = "$" + netProfit.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
function calculateOrdinaryTax(income, status) {
// Simplified 2024 Ordinary Income Brackets for estimation
// This is a helper to estimate Short Term gains impact
var rates = [0.10, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37];
var brackets = [];
if(status === 'single') {
brackets = [11600, 47150, 100525, 191950, 243725, 609350];
} else if(status === 'married_joint') {
brackets = [23200, 94300, 201050, 383900, 487450, 731200];
} else {
// Head of Household
brackets = [16550, 63100, 100500, 191950, 243700, 609350];
}
var tax = 0;
var previousLimit = 0;
var remainingIncome = income;
for (var i = 0; i width) {
tax += width * rates[i];
remainingIncome -= width;
previousLimit = limit;
} else {
tax += remainingIncome * rates[i];
return tax;
}
}
// Highest bracket
tax += remainingIncome * rates[rates.length – 1];
return tax;
}