The tax rate you pay is based on how much of the purchase price falls within each band.
So for example, if you buy a property for £150,000, you won't pay any Stamp Duty on the first £125,000.
As a result, your bill will be 2% of the remaining £25,000, so a total of £500.
If you buy a home for £500,000, then you won't pay any tax on the first £125,000. But you will pay 2% on the next £125,000 of the purchase price (from £125,000 to £250,000) and then 5% on the remainder (from £250,000 to £500,000).
This means a total tax bill of £15,000.