The gross domestic product (GDP) fell by 0.1 per cent during the second quarter, dpa news agency quoted the Office for National Statistics (ONS) as saying.
It is a big step down from the first quarter of the year, when GDP rose 0.8 per cent.
The service sector was particularly badly hit, falling by 0.4 per cent over the quarter, ONS experts said.
A large part of this was in health and social work, and came as less money was spent on the fight against Covid-19.
The GDP fell 0.6 per cent in June, and the ONS revised its May estimate from growth of 0.5 per cent to just 0.4 per cent.
ONS director of economic statistics Darren Morgan said: “With May’s growth revised down a little and June showing a notable fall, overall the economy shrank slightly in the second quarter.
“Health was the biggest reason the economy contracted as both the test and trace and vaccine programmes were wound down, while many retailers also had a tough quarter. These were partially offset by growth in hotels, bars, hairdressers and outdoor events across the quarter, partly as a result of people celebrating the Platinum Jubilee.”
The Bank of England has warned that Britain might enter recession later this year.