
Calculate your average cost basis per share after several purchases at different prices.
Calculate the number of shares to buy based on your available capital, your accepted risk and your stop-loss level.
| Qty | Buy price | Fixed buy fees | Variable buy fees % | Total purchase | Sell price | Fixed sell fees | Variable sell fees % | Total sale | Result | Gain / Loss | Analysis | Tax (15%) | Net result | Note |
| {y} |

Stock Simulator: Calculate the Gain or Loss of a Share Purchase and Sale
This stock and share simulator lets you calculate the result of a stock market trade based on the purchase and sale of shares.
You can very quickly find out the potential gain or loss of a transaction, taking into account fees, the break-even point, taxes (15% long-term capital gains), the average cost basis (multiple buys) and risk management.
Stocks and the stock market
A stock market order or trade is executed when you buy or sell shares. To do this, you need a brokerage account. You can open this kind of account with banks or online brokers — for example Fidelity, Charles Schwab or Robinhood. Of course, fees may be charged per order. The cost depends on each institution's pricing.
Cryptocurrencies
This simulator also works very well for buying and selling cryptocurrencies (Bitcoin, Ethereum or any other crypto). Unlike stocks, they are not held in a brokerage account but in a wallet or on an exchange, which generally charges fixed and/or variable fees on both the purchase and the sale — enter them in the corresponding fields.
In the United States, gains realized when selling cryptocurrencies are, like stocks, subject to capital gains tax. You can use the Estimate tax option to estimate the tax due on your trade.
Quickly calculate a buy and sell order for the same security
The goal of this calculator is to quickly compute the result of a share purchase and sale.
With this information, you can analyze a situation and make a decision. For example, we can calculate the target we are aiming for or the maximum loss we accept.
Using the simulator
This financial calculator has several fields to fill in. Once all the required fields are completed, it automatically calculates the purchase total, the sale total, and the final result (gain or loss).
Option ➧
You can choose between two options:
- By quantity
- By total purchase
Depending on the selected option, you either enter the number of shares bought or the total amount of the purchase.
Quantity ➧
You can enter the number of shares purchased, including a fraction of a share (e.g. 2.5) if your broker offers fractional shares. The simulator automatically calculates the purchase total.
If you selected the "By total purchase" option, this field is disabled and the quantity (possibly fractional) is derived automatically from the invested amount.
Buy price ➧
Enter the purchase price of the share. You can find it on stock market websites or broker platforms.
The buy price is the amount for the purchase of one share. It is essential to enter it accurately to get a reliable calculation.
Fixed buy fees ➧
Enter the fixed purchase fees. These fees are charged by the bank or broker for each order placed.
If you have no fixed fees, you can leave this field empty or fill it with 0.
Variable buy fees % ➧
You can enter the variable purchase fees if there are any. In this simulator, variable fees must be expressed as a percentage. They are calculated on the total purchase amount.
This field can stay empty or contain 0 if you have no variable fees.
Total purchase ➧
This field is the total amount of the purchase. It is calculated automatically from the number of shares, the buy price, the fixed fees and the variable fees if you chose the "By quantity" option. Otherwise, fill it in manually.
Sell price ➧
Enter the price at which the share was sold. This amount is available on specialized stock market websites or from your broker.
Fixed sell fees ➧
Same principle as the fixed buy fees, but this time for the sale.
Variable sell fees % ➧
Works the same way as the variable buy fees, except it applies to the sale.
Total sale ➧
This field is the total amount of the sale. It is calculated automatically from the number of shares, the sell price, the fixed fees and the variable fees if you chose the "By quantity" option. Otherwise, fill it in manually.
Result ➧
The result is calculated automatically. It is the difference between the purchase total and the sale total.
The result can be positive (gain) or negative (loss).
The result is displayed in red if it is a loss and in green if it is a gain.
Gain / Loss ➧
This field automatically shows the gain or loss percentage, calculated from the obtained result.
It is displayed in red for a loss, and in green for a gain.
Handy tools for traders
Break-even point ➧
As soon as you have entered the quantity (or the purchase total) and the buy price, the simulator automatically displays the minimum sell price to reach in order not to lose money, sale fees included. This lets you quickly set an exit target without doing the math manually.
Estimate tax (15% long-term capital gains) ➧
Enable this option to estimate the tax due on a gain using the common 15% long-term capital gains rate. The simulator displays the tax amount as well as the net result after tax. No tax is calculated in the event of a loss.
Cost basis (multiple buys) ➧
This tool calculates your average cost basis, i.e. the weighted average purchase price of your shares when you have bought the same security several times at different prices (for example with dollar-cost averaging or when adding to a position). Add one line per purchase (quantity, price, fees), and the simulator calculates the total quantity held, the total amount invested and the average cost basis. The Use this cost basis button copies these values directly into the main calculator.
Risk management (position sizing) ➧
This tool calculates the number of shares to buy based on your available capital, the percentage of risk you accept on this trade, and your stop-loss level. It is a common risk management method among traders: never risk more than a certain percentage of your capital on a single position. The Use this quantity button copies the recommended quantity and the entry price into the main calculator.
⚠️ Precautions
Before diving into the stock market, it is important to take some precautions:
- Never invest more than you can afford to lose.
- Don't panic when markets fall.
- Don't be swayed by other people's advice.
- Do your own research and analysis before investing.
- Don't invest in financial products you don't understand.
- Remember that the stock market involves risk and that it is possible to lose all your money.
It is therefore essential to be well informed before starting to invest in the stock market.
Save and export your financial results in CSV or PDF format.
You can save your results by clicking the Save button. You can then export them in CSV or PDF format to share them or for other purposes.
Keyboard shortcuts
You can use keyboard shortcuts to make this stock simulator easier to use.
Here are the available shortcuts:
m ⇝ Clear
f ⇝ Save
Why use this simulator?
This simulator is a practical tool for stock market investors. It lets you quickly estimate the result of a share purchase and sale.
It is aimed both at those who want to analyze a situation before investing and at those who want to better understand how financial markets work.
It is also a good way to get familiar with the mechanics of the stock market, with ease.
⚠️ Remember that any stock market investment involves risk, including the possibility of losing the entire invested capital.