China Transit Visa Free in 72 hours
In order to accommodate the international visitors' short stay in China, 72-Hour Visa Free Transit policy is launched in many Chinese cities or ports. These days, 18 Chinee cities follow this policy of visa-free transit in China. This policy allows transit passengers with passport of 51 countries to stay for up to 72 hours without a visa on direct transit. British and Irish nationals are in the list of 51 countries fortuanately. More details are http://www.chinese-embassy.org.uk/eng/visa/notice/t1003320.htm
Shanghai Transit visa free in 144 hours
Shanghai government carries out 144 hours transit free for British and Irish nationals. If you are transiting through a port in Shanghai, and travelling on a third country within 144 hours, you'll enjoy the policy of 144 hours visa free. More details are https://www.gov.uk/foreign-travel-advice/china/entry-requirements
Regarding some special cases, i2visa suggest that you should check with Chinese Embassy or General Consulate or Chinese Visa Application Service Centre before travelling to China for the guaranteed transit free.