The charge applies to buys, not sells, and is levied at a set percentage of consideration on shares of UK incorporated companies. Purchases of overseas-incorporated shares and of most exchange traded funds domiciled outside the UK fall outside it.
Exemptions that matter to traders include instruments settled without a transfer of beneficial ownership, such as spread bets and contracts for difference, though the provider generally hedges in the underlying and prices the cost in.
Because it applies inside a stocks-and-shares-isa as well, the tax is unavoidable for direct UK share buying and is a real drag on high-turnover strategies in UK names.
General information about the United Kingdom, not tax advice. Rules change and depend on your circumstances; verify with a qualified adviser.
Related: uk-capital-gains-tax, stocks-and-shares-isa, uk-spread-betting-tax, hmrc