How much tax will you pay?
Things are different when it comes to tax on share-price increases, because that falls under capital gains tax. And the nice thing there is that we each have an annual tax-free allowance in addition to our income tax allowances.
Currently, individuals enjoy a £10,600 tax-free allowance, so you won't pay capital gains tax until you exceed that threshold in any one year. That might sound a lot, but if you're starting to invest today with a 20- or 30-year horizon, by the time you retire you could easily be earning a lot more than that per year.
Capital gains tax is only payable when you dispose of your shares, and there's nothing to pay on increases in the values of shares that you continue to hold. But when you do sell, you still only have one year's allowance to use, for the year in which you sell. If you hold shares for 10 years and then sell them, you don't get 10 years' worth of allowance.
Bed and breakfast
For that reason, people will often sell a shareholding in order to crystalise a capital gain and write it off under that year's allowance, and then reinvest the money in the same (or different) shares some time afterwards. It's a practice known as "bed and breakfasting", and for years people would sell shares on the last day of the financial year and buy them back the next day.
The government didn't like that, and changed the rules so that if you sell shares and then re-buy the same ones within 30 days, it still counts as the original holding and gains don't qualify for your capital gains allowance. But you should still be okay provided you wait at least 30 days from selling before you buy the shares again.
Pay no tax at all?
Of course, if you want to avoid capital gains tax altogether, you just need to buy your shares inside an ISA. For the 2012-13 tax year, you can invest up to £11,280 in a shares ISA, and you won't pay a penny in capital gains tax, no matter how much the shares rise or how long you hold them. Sadly, you can't reclaim the tax already taken from dividends, but at least you won't be eligible for any higher rate tax on them.
Finally, before we leave, it's good to be reminded of an old saying, that you should never let the tax tail wag the investment dog. That means we should put the quality of an investment ahead of its tax implications -- it's better to pay tax on a good investment than not pay tax on a bad one.