Is it illegal to ride a bike without a helmet in the UK?

No.

The Highway Code suggests cyclists should wear approved cycle helmets, but there is no UK law compelling riders to wear them.

This is the case with most countries and territories in the World, with the notable exceptions of Australia and New Zealand.

However, this doesn't mean that you shouldn't wear a helmet!