Capital Gains Tax Calculator
Estimate the federal tax owed when you sell a stock or asset, distinguishing between short-term and long-term rates. Use it before selling to plan the timing of a transaction and minimize your tax bill.
About this calculator
Capital gains tax is levied on the profit earned when you sell an asset for more than you paid. The taxable gain is simply: Gain = Sale Price − Purchase Price. The tax owed then depends on how long you held the asset. If held for one year or less (short-term), the gain is taxed at your ordinary income tax bracket rate. If held for more than one year (long-term), a preferential rate — typically 0%, 15%, or 20% depending on income — applies. The formula used here is: Tax = (Sale Price − Purchase Price) × Rate, where Rate equals your income tax bracket for short-term gains or 15% (default long-term rate) for long-term gains. Timing a sale to cross the one-year threshold can produce substantial tax savings.
How to use
Suppose you bought shares for $4,000 and sold them for $7,000, realizing a $3,000 gain. If you held for only 8 months (short-term) and your income tax bracket is 22%, the tax is: Tax = ($7,000 − $4,000) × 0.22 = $3,000 × 0.22 = $660. If instead you waited until you had held the shares for over a year (long-term), the default 15% rate applies: Tax = $3,000 × 0.15 = $450. Waiting a few extra months in this example saves $210 in taxes.
Frequently asked questions
What is the difference between short-term and long-term capital gains tax rates?
Short-term capital gains apply to assets sold within one year of purchase and are taxed at your ordinary federal income tax rate, which can be as high as 37% for top earners. Long-term capital gains, for assets held longer than one year, benefit from reduced rates of 0%, 15%, or 20% depending on your taxable income. This difference creates a powerful incentive to hold investments for at least one year before selling. State income taxes may apply on top of these federal rates and vary widely by location.
How do I calculate capital gains tax when I have multiple lots of the same stock?
When you hold multiple purchase lots of the same stock, you can choose which lot to sell using methods like FIFO (first-in, first-out), specific identification, or average cost basis. Specific identification is the most flexible — it lets you sell the highest-cost shares first to minimize your taxable gain. Your brokerage typically lets you designate the lot at the time of the trade. Keeping detailed records of each purchase price and date is essential for accurate tax reporting on Schedule D.
Can capital losses offset capital gains to reduce my tax bill?
Yes — capital losses from the sale of other investments can be used to directly offset capital gains dollar for dollar, a strategy known as tax-loss harvesting. If your losses exceed your gains in a given year, you can deduct up to $3,000 of the excess against ordinary income, with any remaining losses carried forward to future tax years. This makes reviewing your portfolio for losing positions near year-end a worthwhile exercise. The wash-sale rule prevents you from immediately repurchasing a substantially identical security within 30 days before or after the sale.