You can keep the cash in your account as long as you want, but you have to pay a tax on what's called capital gains.
To quote from Wikipedia:
A capital gain is a profit that results from investments into a capital asset, such as stocks, bonds or real estate, which exceeds the purchase price. It is the difference between a higher selling price and a lower purchase price, resulting in a financial gain for the investor.[1] Conversely, a capital loss arises if the proceeds from the sale of a capital asset are less than the purchase price.
Thus, buying/selling stock counts as investment income which would be a capital gain/loss. When you are filing taxes, you have to report net capital gain/loss
. So you don't pay taxes on an individual stock sale or purchase - you pay tax on the sum of all your transactions.
Note: You do not pay any tax if you have a net capital loss. Taxes are only on capital gains.
The amount you are taxed depends on your tax bracket and your holding period. A short term capital gain
is gain on an investment held for less than one year. These gains are taxed at your ordinary income tax rate.
A long term capital gain
is gain on an investment held for more than one year. These gains are taxed at a special rate: If your income tax rate is 10 or 15%, then long term gains are taxed at 0% i.e. no tax, otherwise the tax rate is 15%.
So you're not taxed on specific stock sales - you're taxed on your total gain. There is no tax for a capital loss, and investors sometimes take profits from good investments and take losses from bad investments to lower their total capital gain so they won't be taxed as much.
The tax rate is expected to change in 2013, but the current ratios could be extended. Until then, however, the rate is as is.
Of course, this all applies if you live in the United States. Other countries have different measures. Hope it helps!
Wikipedia has a great chart to refer to: http://en.wikipedia.org/wiki/Capital_gains_tax_in_the_United_States.