Long-Term (Over 1 year)
Short-Term (1 year or less)
Use your marginal income tax rate for short-term gains, and your long-term capital gains rate for long-term gains. Consult a tax professional for accuracy.
Estimated Capital Gains Tax
$0.00
This is an estimate. Consult with a qualified tax professional for advice specific to your situation.
Understanding Stock Sale Taxes: Capital Gains
When you sell a stock for more than you paid for it, you realize a capital gain. This gain is generally subject to taxation by the government. The way it's taxed depends significantly on how long you held the stock before selling.
Short-Term vs. Long-Term Capital Gains
Short-Term Capital Gains: If you hold a stock for one year or less before selling it at a profit, the gain is considered short-term. These gains are taxed at your ordinary income tax rate, which can be significantly higher than long-term capital gains rates.
Long-Term Capital Gains: If you hold a stock for more than one year before selling it at a profit, the gain is considered long-term. These gains are typically taxed at preferential rates, which are generally lower than ordinary income tax rates. The specific long-term capital gains tax rates depend on your overall taxable income. For example, in the U.S., common rates are 0%, 15%, or 20%.
Calculating Your Capital Gain
The fundamental calculation for capital gain is straightforward:
Capital Gain = (Sale Price per Share – Purchase Price per Share) * Number of Shares
If the result is positive, you have a capital gain. If it's negative, you have a capital loss, which can potentially be used to offset capital gains or even ordinary income in certain circumstances (consult tax rules for specifics).
Calculating Capital Gains Tax
Once you determine your capital gain, you apply the appropriate tax rate based on your holding period:
Capital Gains Tax = Capital Gain * Applicable Tax Rate
For Short-Term Capital Gains, the "Applicable Tax Rate" is your individual marginal income tax rate.
For Long-Term Capital Gains, the "Applicable Tax Rate" is the specific long-term capital gains tax rate that applies to your income bracket (e.g., 0%, 15%, or 20% in the U.S.).
How This Calculator Works
This calculator simplifies the process. You input the purchase price per share, the number of shares, the sale price per share, your holding period (short-term or long-term), and your estimated tax rate. It then calculates:
The total purchase cost: Purchase Price per Share * Number of Shares
The total sale proceeds: Sale Price per Share * Number of Shares
The total capital gain (or loss): Total Sale Proceeds - Total Purchase Cost
The estimated capital gains tax: Total Capital Gain * (Tax Rate / 100)
Important Note: Tax laws are complex and vary by jurisdiction. This calculator provides an estimate for educational purposes only. It does not account for all potential deductions, losses, fees (like brokerage commissions), or specific tax regulations that may apply to your situation. Always consult with a qualified tax professional or financial advisor for personalized advice.
function calculateStockTax() {
var purchasePrice = parseFloat(document.getElementById("purchasePrice").value);
var numShares = parseInt(document.getElementById("numShares").value);
var salePrice = parseFloat(document.getElementById("salePrice").value);
var holdingPeriod = document.getElementById("longTerm").value;
var taxRateInput = parseFloat(document.getElementById("taxRate").value);
var resultElement = document.getElementById("result-value");
var errorMessage = "";
if (isNaN(purchasePrice) || purchasePrice < 0) {
errorMessage = "Please enter a valid purchase price per share.";
}
if (isNaN(numShares) || numShares <= 0) {
errorMessage = "Please enter a valid number of shares greater than zero.";
}
if (isNaN(salePrice) || salePrice < 0) {
errorMessage = "Please enter a valid sale price per share.";
}
if (isNaN(taxRateInput) || taxRateInput 0) {
// Only calculate tax if there's a gain
estimatedTax = capitalGain * taxRate;
} else {
// If it's a loss or zero gain, tax is $0
estimatedTax = 0;
}
// Format the result
var formattedTax = estimatedTax.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
resultElement.textContent = formattedTax;
resultElement.style.color = "#28a745"; // Green for success
}