Tax is worked out using the tax code you are allocated by Inland Revenue. Common one for this year is 503L which means you can earn �5035 per year tax free. Once over that limit there is a 10% tax on anything up to �2090, then a further 22% on anything up to �32400,.
National Insurance is calculated using earnings bands first, Lower Limit, Threshold & Upper Limit. Then it is calculated using rates such as Rate A, (standard rate for example) which the cost of NI is then calculated using your gross earnings. You pay NI on any amount over �97 a week currently.