How this calculator works
Your profit is what you got back minus what you put in. What you put in is the shares times the buy price, plus the fee to buy. What you got back is the shares you hold at the end times the sell price, minus the fee to sell, plus every dividend paid to you in cash.
With the numbers already in the boxes, you bought 100 shares at $40 on March 5, 2018, with a $5 fee. A 2-for-1 split turned them into 200, they paid $1,140.00 in dividends, and you sold them at $31.50 on June 16, 2025, with another $5 fee. You put in $4,005.00 and got back $7,435.00: a profit of $3,430.00, or +85.64% in total. Over those 7.28 years, that’s 8.87% a year.
The yearly return spreads that total over the time you held the stock. It’s one plus the total return, raised to the power of one over the years, minus one. The years come from your two dates: the days in between, divided by 365.25. A dividend total counts as if it all came on the sell date. If the dividends came in earlier, your real yearly return was a little higher than that when you made money, and a little lower when you lost. List them with their dates and the calculator counts each one on its day. It finds the one yearly rate that fits every amount on its date, the same math as XIRR in a spreadsheet. That’s the return on your own money, counting when each amount came back to you. Add the share price on each dividend you took in cash and you also get the stock’s own return, with every dividend put back into it on its day and no fees. That’s the fairer number to set next to an index, because an index is measured the same way, and the calculator sets it next to the S&P 500 too. Under a year, the calculator doesn’t show a yearly rate: a few months stretched to a full year can make the number look much bigger or smaller than it was.
When you sold only part
If you sold only some of your shares, the result has two parts. The realized result is the gain or loss on the shares you sold, and that’s what you pay tax on now. The unrealized result is the paper gain or loss on the shares you still have, valued here at the same sell price. Most brokers show the two separately and leave the cash dividends out of both, so those two numbers won’t add up to your total here.
The calculator counts the shares you bought first as the first ones sold. Brokers call that first in, first out, and most US brokers do it unless you pick the shares yourself. It’s also what the IRS assumes when you don’t say which shares you sold. If you told your broker which shares to sell when you sold, choose the same ones under “Which shares you sold”: the last ones you got, the ones that cost the most per share, or one lot, meaning one batch of shares you got on the same day, either the shares from your buy or the ones a single dividend bought. With your dividends listed by date, each reinvested dividend is its own lot, with its own cost and its own date. Without dates, the shares your dividends bought go last, at what they cost on average. Some brokers use the average cost instead, which the IRS allows for fund shares and for shares bought through a dividend reinvestment plan. This calculator doesn’t, so if your broker’s tax form says average cost, its number will differ.
Inflation by the month
For a stock in dollars, the calculator takes inflation from the US consumer price index, the CPI-U, which tracks the prices most Americans pay for everyday things. The Bureau of Labor Statistics publishes it every month. The calculator divides the index in the month you sold by the index in the month you bought. So a year like 2022, when US prices rose 6.5%, counts for what it really was. The numbers here run from January 1913 to September 2026. Prices for October 2025 were never collected, because of the government shutdown, so the calculator uses the point halfway between September and November. For the months after the latest one in the data, it uses the yearly rate you type. For a stock in another currency, it uses only that rate. If you live outside the US, pick “A yearly rate I type” and use your own country’s inflation.
In the example, US prices rose 29.3% from March 2018 to June 2025, about 3.59% a year. So the stock’s 8.87% a year comes to 5.1% a year in what the money buys.
What the price alone leaves out
In that example, the price alone went from $20 to $31.50 once you count the split, a gain of +57.5%. With the dividends and the fees, the total return is +85.64%. If you only looked at the price, you’d think the stock made you about two thirds of what it did.
Splits trip people up too. After a 2-for-1 split, your broker shows half the price and twice the shares, and your profit is the same as before. Put in the price you paid and the split ratio, and the calculator lines the two prices up. A reverse split can leave you with part of a share, and brokers usually pay cash for it. Put that cash in “The split, in more detail”, and the calculator counts it as selling that part of a share.
Taxes, roughly
In the US, a gain on a stock you held for more than a year is a long-term gain. In 2026 it’s taxed at 0%, 15% or 20%, depending on your taxable income. Held a year or less, it’s a short-term gain, taxed like your pay, at 10% to 37%. The calculator reads the holding period from your two dates. The clock starts the day after you buy, so a stock bought on March 1 is long term if you sell it on March 2 of the next year or later.
| Long-term rate | Single | Married filing jointly |
|---|---|---|
| 0% | Up to $49,450 | Up to $98,900 |
| 15% | $49,451 to $545,500 | $98,901 to $613,700 |
| 20% | Over $545,500 | Over $613,700 |
Taxable income in 2026. Source: IRS, Revenue Procedure 2025-32.
If you pick the US brackets, the calculator adds this gain and the dividends to the taxable income you type and looks up your rates. To keep it simple, the calculator taxes the whole gain at the rate of the bracket the gain ends in, even when part of the gain would fall in a lower one. Near a bracket line, that can show more tax than you’d really pay. Above $200,000 of income ($250,000 married filing jointly, $125,000 married filing separately) it adds the 3.8% tax on investment income, and your state’s rate on top if you type one. The real test for the 3.8% uses your modified adjusted gross income, your income before most deductions, and the tax only hits the part above the line, so near it the number is rougher. A sale in 2025 uses the 2025 brackets, from IRS Revenue Procedure 2024-40, and a sale in 2026 or later uses the 2026 ones. Years before 2025 had slightly lower thresholds, and the calculator uses the 2025 ones for them. It also taxes all the dividends at the rates of the year you sold, even the ones you got in earlier years.
Dividends are taxed in the year you get them, even when they buy more shares. Those reinvested dividends then become part of what your shares cost, so when you sell, you don’t pay tax on that money a second time. A dividend pays the long-term rate only if it’s qualified: for a common stock, you have to have held it more than 60 days in the 121 days around the ex-dividend date, the first day the stock trades without its next dividend. If you list your dividends with dates, the calculator checks that rule, with the date you type standing in for the ex-dividend date. Statements usually show the day the dividend was paid, a few weeks after the ex-dividend date, so close to the 60-day line the check can be off. Without dates, it counts every dividend as qualified. Most dividends from REITs, the companies that own buildings and pay out most of their rent, aren’t qualified, so pick your own rates for those. Shares your dividends bought a year or less before the sale are short term. With your dividends listed by date, the calculator taxes those shares that way and says which ones they are. With only the totals, it can’t tell them apart and gives them your buy’s holding period.
A loss can lower your taxes. It offsets your gains first, and then up to $3,000 a year of your other income ($1,500 married filing separately). What’s left carries over to later years. If you buy the same stock within 30 days before or after selling it at a loss, that loss doesn’t count yet. It moves into the cost of the new shares, and the days you held the old shares count toward the new ones’ holding period. That’s the wash sale rule, and buying an option on the same stock counts as a purchase. Type that purchase in “Bought the same stock again near the sale” and the calculator checks it. A dividend reinvested in those days counts too, and if you list your dividends with dates, the calculator checks those on its own. Shares your spouse buys count as well, so type those in. If you bought the new shares in your IRA, the loss is gone for good: it can’t move into an IRA, and the new cost the calculator shows doesn’t apply.
If you live outside the US, the US usually keeps 30% of each dividend from a US company before you get it, or less if your country has a tax treaty with the US and you’ve filed a W-8BEN form with your broker. Put that rate in “Withholding at the source” and pick whether you can claim it back at home as a credit. Then pick “My own rates” and type your country’s. If you live in the US and own a foreign company, its country may keep part of each dividend too, and you can usually take it as a foreign tax credit.
All of this is a rough number, not your tax bill. Your other gains and losses, your deductions and your state’s own rules change it.
Against the S&P 500
To see how a stock did, compare it with the S&P 500. The index is what you’d have made by owning about 500 of the largest US companies and holding on. The calculator uses the S&P 500’s yearly returns with dividends put back in, from 1928 to 2025, and, from 1960, its level at the end of each year for the price alone. Both come from Aswath Damodaran at NYU Stern. They go by calendar years, so the calculator compares your stock with the calendar years closest to your dates. A date in the first half of a year goes back to the end of the year before.
S&P 500 is a registered trademark of Standard & Poor’s Financial Services LLC, and the index is a product of S&P Dow Jones Indices LLC. Bufetico isn’t affiliated with them or endorsed by them.
In the example, the closest years run from the end of 2017 to the end of 2024. The S&P 500 returned 13.71% a year with dividends put back in over those years, against 8.87% a year for the stock. At the index’s rate, the same $4,005.00 would have become about $10,209.47, compared to $7,435.00 in the stock.
If you want your exact dates, open “Exact S&P 500 levels” and type the index level on each one. That comparison is on price alone, because the level of the index doesn’t include dividends.
What a profit number doesn’t see
A profit number can be off in either direction, usually for one of these reasons.
- Fees on both sides. They come out when you buy and again when you sell. On a small position, two fees can take a real bite out of the gain.
- Dividends left out, or counted twice. Leave out the dividends you got in cash and your profit looks smaller than it was. If they bought more shares, don’t add them again as cash: they’re already in the shares you sell.
- A split you didn’t count. Compare a price after a split with the price you paid before it, and a winner looks like a loser. Put the ratio in its box.
- A short holding turned into a yearly rate. 20% in three months works out to more than 100% a year. One good quarter doesn’t mean the stock keeps that pace for a year.
- Money you added later. This calculator follows one buy. If you bought at several prices, the stock average calculator works out your average cost. If you added money over the years, the “With deposits” tab of the growth rate calculator counts each deposit on its date.
- The exchange rate. If you bought a US stock with euros, pounds or pesos, the dollar’s move can add to your result or wipe it out. Open “Bought in another currency” to see both parts.
- Inflation. A 30% gain over ten years is about 2.66% a year. With 2% inflation, what that money buys grew about 0.65% a year. And inflation isn’t always 2%: US prices rose 17.8% from the end of 2020 to the end of 2023. That’s why, for a stock in dollars, the calculator uses the actual price index for the months you bought and sold.
- Spin-offs and capital paid back. If the company paid you back part of your capital, mark that line capital in the dividend list, and the calculator takes it off your cost. If the company split off a business, part of your cost moved to the new shares. This calculator doesn’t track that, so go by the cost basis your broker shows, the cost it reports for tax.
- Special dividends. A special dividend is a one-time payment on top of the regular ones. Mark it special in the dividend list, and the result shows it apart. It counts in your result and is taxed like the others, unless your statement calls it a return of capital (box 3 of Form 1099-DIV, nondividend distributions), and then mark it capital instead.
- ADR fees. An ADR is a US share that stands for shares of a foreign company, and the bank behind it can charge a small fee per share. Add what you paid to the fee to sell.
The costs that eat a gain before you see it, from the gap between the buy and sell price to taxes, are in a lesson of the free course.
Questions people ask
How do I calculate the profit on a stock?
Take what you got back from the sale after the fee to sell, add the dividends you got in cash, and subtract what you paid, fees included. Profit = (shares you sell × sell price − fee to sell) + dividends − (shares you bought × buy price + fee to buy). After a split, the two share counts are different.
How do I calculate my return with dividends?
Add the dividends to what you got back and subtract what you put in. That’s your profit. Divide it by what you put in and you have the total return. If the dividends bought more shares, count those shares in the sale instead of adding the dividends as cash.
What’s the difference between total return and yearly return?
The total return is the whole gain over the whole time: 50% means you made half of what you put in. The yearly return is the rate that, earned the same each year, gets you to that total. 50% over five years is about 8.45% a year.
How is a stock profit taxed in the US?
It depends on how long you held the stock. Over a year, it’s a long-term gain, taxed at 0%, 15% or 20% in 2026, by income. A year or less, it’s a short-term gain, taxed like your pay. Dividends are taxed in the year you get them, and qualified dividends pay the long-term rates. A loss can offset your gains, and up to $3,000 a year of your other income ($1,500 married filing separately). This calculator gives a rough number, not tax advice.
Does a stock split change my profit?
No. A 2-for-1 split doubles your shares and halves the price, so what you own is worth the same. It only matters for the math: compare the two prices on the same basis. The calculator does that when you put in the split ratio.
Did my stock do better than the S&P 500?
Compare your yearly return with the S&P 500’s over the same years, with dividends put back in. Many charts show the price alone, which leaves the dividends out. The calculator uses the calendar years closest to your dates, and your exact dates on price alone if you type the index levels.
What if I sold only part of my shares?
Open “Sold only part of the shares” and type how many you sold, and the calculator splits the result in two. The realized part is the gain or loss on the shares you sold, and that’s what counts for your taxes now. The unrealized part is the gain or loss on paper on the shares you kept. It counts your first shares as the first ones sold, unless you pick the last ones, the ones that cost the most, or one lot. If you bought at several prices, the stock average calculator keeps track of each buy and each sale.
What’s the difference between my return and the stock’s return?
Your return counts your own money: the fees you paid and the day each dividend reached you. The stock’s own return puts every dividend back into the stock on its day and leaves the fees out, the way an index is measured. Add the share price after an @ on each dividend you took in cash, and the calculator shows both. Brokers call the first one money-weighted and the second one time-weighted.
How do I count dividends paid on different dates?
List each one with its date in “Dividends with their dates”, or paste them from your broker’s statement. The calculator then finds the one yearly rate that fits every amount on its date, the way XIRR does in a spreadsheet. Counting each dividend on its date moves the rate a little from the one with a single total: up when you made money, down when you lost.
What is a wash sale?
In the US, if you sell a stock at a loss and buy the same stock within 30 days before or after the sale, the loss doesn’t count yet. It’s added to the cost of the new shares, so you get it back when you sell them. Type that other purchase in “Bought the same stock again near the sale” and the calculator checks the dates and shows the new cost. If the new shares are in your IRA, the loss is gone for good.
How do I adjust my stock return for inflation?
Take the yearly inflation out of the yearly return: (1 + return) ÷ (1 + inflation) − 1. For a stock in dollars, the calculator uses the US consumer price index from the month you bought to the month you sold, so the years with high inflation count for what they were.
What is a break-even price?
It’s the sell price where you get back exactly what you put in. Here it counts the fees on both sides, and a second number also counts the dividends you already got.