There are a few factors to consider when deciding how many shares of a particular stock to buy. In addition to your available capital, you should consider diversification and purchasing fractional shares of stock.
With that in mind, here's a quick guide that can help you determine the ideal number of shares to buy.

Share
To help you determine how many shares of a particular stock you can buy, here's a three-step process to use:
Find the current share price of the stock you want
You can obtain the share price through your broker or from a financial website. Make sure you're looking at a real-time quote, not a delayed one. Some public news sites offer quotes delayed by 20 minutes or so.
Divide the amount of money you have available to invest in the stock by its current share price.
For example, if you have $1,000 to invest and a stock is trading for $40, this equals 25 shares. Of course, in the real world, you will probably not get a whole number, and that's why the next step is needed.
Determine the number of shares you can buy
If your broker allows you to buy fractional shares, or you got a whole number in the second step, the result is the number of shares you can buy. If you can't buy fractional shares, round down to the nearest whole number.
Example
As an example, let's say you want to buy Apple (AAPL +0.54%) stock, and you have $2,000 to invest. According to a real-time stock quote, Apple is trading for $183.20 per share as I'm writing this. Dividing those two numbers would give you about 10.92 shares. If your broker supports fractional shares, this means you can afford to buy 10.92 shares of Apple. If your broker doesn't support fractional shares, you would be able to buy 10 shares.
What about diversification?
Here's an important point, especially for newer investors. Just because you can buy a certain number of shares of a particular stock doesn't mean you should. For example, if you put $1,000 into a newly opened brokerage account and a stock you want to own trades for $50, you have the ability to buy as many as 20 shares.
However, don't forget about portfolio diversification. Instead of a large position in one stock, a better investment strategy is spreading your initial brokerage deposit across a few different companies.
Most experts tell beginners that if you're going to invest in individual stocks, you should ultimately try to have at least 10 to 15 different stocks in your portfolio to properly diversify your holdings. Since most brokers no longer charge commissions for online stock trades and many allow you to buy fractional shares, it's more practical than ever to spread a relatively small amount of capital across many different stock positions.
Buy-and-Hold Strategy
However, if your broker is one of the few who still charges commissions, it might not be practical to make small investments. If you are still paying commissions, consider making the switch to a top-rated online broker who doesn't charge commissions on online stock trades. Let's be perfectly clear: With so many great commission-free options, there is no reason to pay commissions on online stock trades.