Shares calculator: how many shares to buy
To find how many shares to buy, multiply your contribution by each position’s target percentage, then divide by that position’s share price: shares = (contribution × target %) ÷ share price. The arithmetic is easy. The awkward part is that share prices rarely divide evenly into your contribution, so buying whole shares always leaves some cash uninvested — and the smaller your contribution, the bigger that leftover is as a share of the total.
The formula
For each position you hold:
- Dollar target = contribution × target percentage
- Exact shares = dollar target ÷ current share price
- Shares to buy = the exact figure, rounded down to a whole share (unless your broker supports fractional shares)
Rounding down rather than to the nearest whole share matters: rounding up means committing money you have not deposited, and the order is rejected or settles into a cash debit.
Worked example: a $6,000 contribution across three funds
Target allocation of 70% US stocks, 20% international, 10% bonds. Share prices here are illustrative round numbers for the arithmetic, not quotes:
| Position | Target % | Dollar target | Share price | Exact shares | Buy | Cost |
|---|---|---|---|---|---|---|
| US total market ETF | 70% | $4,200.00 | $268.42 | 15.6471 | 15 | $4,026.30 |
| International ETF | 20% | $1,200.00 | $61.35 | 19.5599 | 19 | $1,165.65 |
| Bond ETF | 10% | $600.00 | $73.18 | 8.1990 | 8 | $585.44 |
| Total | 100% | $6,000.00 | — | — | — | $5,777.39 |
You buy 15, 19 and 8 shares, spend $5,777.39, and $222.61 stays in cash — 3.7% of the contribution.
What the rounding actually costs you
The intuitive worry is that rounding wrecks your allocation. It mostly does not. Measured against what you actually invested, the example above lands at:
| Position | Target | Actual | Drift |
|---|---|---|---|
| US total market ETF | 70.0% | 69.7% | −0.3 pt |
| International ETF | 20.0% | 20.2% | +0.2 pt |
| Bond ETF | 10.0% | 10.1% | +0.1 pt |
Three tenths of a point is noise. The real cost is the uninvested $222.61, not the mix. That reframes the problem: you are not trying to protect your allocation from rounding, you are trying to stop cash piling up in the account. Which is why the honest options are to carry the remainder into next month’s contribution, or to top up the position that is furthest below its dollar target if a single share fits inside the leftover.
In the example, no single US share fits — one costs $268.42 and only $222.61 is left — so the disciplined move is to carry it forward rather than distort the plan buying something you wanted less of.
Small contributions are the hard case
The same three funds and the same 70/20/10 target, but a $500 monthly contribution:
| Position | Dollar target | Exact shares | Buy | Cost |
|---|---|---|---|---|
| US total market ETF | $350.00 | 1.3039 | 1 | $268.42 |
| International ETF | $100.00 | 1.6300 | 1 | $61.35 |
| Bond ETF | $50.00 | 0.6832 | 0 | $0.00 |
| Total | $500.00 | — | — | $329.77 |
Now $170.23 is left over — 34% of the contribution — and the bond sleeve gets nothing at all, because half a target dollar amount of $50 does not reach one $73.18 share. Repeat that monthly and the bond allocation quietly stays at zero while cash accumulates.
This is the single best argument for either fractional shares or a deliberate rotation, described below. It is also why "just divide it up" advice falls apart in real accounts: the maths is fine, the share prices are the obstacle.
Whole shares versus fractional shares
| Whole shares | Fractional shares | |
|---|---|---|
| Hits the target exactly | No — always rounds down | Yes, to the broker’s precision |
| Leftover cash | Up to one share price per position | Effectively none |
| Small contributions | Positions can receive nothing | Every position gets funded |
| Availability | Everywhere | Broker-dependent; often excluded from some order types |
If your broker supports fractional shares for the funds you hold, most of this problem disappears — use the exact figure from step 2 and stop there. If it does not, plan around the rounding instead of fighting it.
The rotation approach
Rather than underfunding the same position every month, rotate which position absorbs the leftover. In the $500 example, the bond sleeve gets nothing in month one; if you carry the $170.23 forward, month two has $670.23 to work with and one $73.18 bond share comfortably fits. Over a few months the average allocation tracks the target closely even though no single month does.
Using new contributions to rebalance
If a position has drifted above its target, the reflex is to sell some. In a taxable account that realises gains; in any account it costs a round trip of spreads. Directing new contributions toward the underweight positions moves you back toward target without selling anything.
The arithmetic changes slightly: instead of applying target percentages to the contribution, apply them to total portfolio value after the contribution, then buy the difference.
- Post-contribution total = current portfolio value + contribution
- Position target = post-contribution total × target %
- Dollars to add = position target − current position value (skip anything already at or above target)
- Shares to buy = dollars to add ÷ share price, rounded down
With a large enough portfolio relative to the contribution, this will sometimes tell you to put the entire contribution into one position. That is correct, not a mistake.
Common mistakes
- Rounding to the nearest share instead of down. Rounds up commit money you have not deposited.
- Using yesterday’s price. The share count is only valid at the price you used. A few percent of price movement changes the answer, most visibly on high-priced shares.
- Applying target percentages to the contribution when you meant to rebalance. Those are two different calculations, and the second one is the one that fixes drift.
- Ignoring the leftover. A few hundred dollars a month sitting as cash is a real drag; it needs a home, even if that home is next month.
- Forgetting the contribution cap. If this is an IRA or HSA, the annual limit binds regardless of the share maths. See the 2026 contribution limits and Roth IRA limits.
PreTrade Planner does exactly this arithmetic for every contribution. Set your positions and target allocation once, enter the amount, and get whole-share quantities plus the leftover, before you place a single order. Planning only: it never connects to your brokerage and never places trades. Free tier available.
Open the shares calculatorFrequently asked questions
How do I calculate how many shares to buy?
Multiply your contribution by the position target percentage to get a dollar target, then divide that by the current share price. Round down to a whole share unless your broker supports fractional shares. For example, a $6,000 contribution with a 70% target and a $268.42 share price gives $4,200 divided by $268.42, or 15.6471 shares, so you buy 15.
Should I round up or down when buying shares?
Round down. Rounding up commits money you have not deposited, so the order is either rejected or settles into a cash debit. Rounding down leaves a small amount of cash, which you carry into the next contribution.
Why is there always money left over after I buy?
Because share prices rarely divide evenly into a dollar amount. Each position can leave up to one share price uninvested. On a $6,000 contribution across three funds that was $222.61, or 3.7%. On a $500 contribution it was $170.23, or 34%, because the individual share prices are large relative to the amount being invested.
Does whole-share rounding ruin my target allocation?
Usually not. In the worked $6,000 example the resulting mix was 69.7 / 20.2 / 10.1 against a 70 / 20 / 10 target, a drift of about three tenths of a percentage point. The meaningful cost is the uninvested cash rather than the drift, so plan around the leftover rather than the percentages.
What if my contribution is too small to buy one share of everything?
Either use fractional shares if your broker offers them, or rotate which position gets funded. Carrying the leftover forward means a position skipped this month is usually affordable next month, so the average allocation tracks the target even though no single month does.
How do I use new contributions to rebalance instead of selling?
Apply your target percentages to the total portfolio value after the contribution rather than to the contribution alone, then buy the difference for each position that is below its target. This moves you toward the target without realising gains. It can direct the whole contribution into one position, which is the correct result.
Educational content only. This is not investment advice, and no security mentioned is a recommendation. Share prices in the examples are illustrative figures chosen to make the arithmetic clear, not quotes; your own numbers depend on prices at the moment you place an order.
PreTrade Planner is a planning-only calculator that converts investment contributions into exact share quantities; it never connects to a brokerage.