The ONS said: "This is the largest quarterly contraction in the UK economy since ONS quarterly records began in 1955, and reflects the ongoing public health restrictions and forms of voluntary social distancing that have been put in place in response to the coronavirus pandemic.
"In level terms, real GDP was last lower in Quarter 2 2003. Compared with the same quarter a year ago, the UK economy fell by 21.7%."
Compared to other countries the UK fared a little better than Spain, which was down 23% over the period, but worse than the US which dropped by 11%. The UK also performed worse than France, Italy and Germany over the second quarter.
Only Spain performed worse than the UK
ONS
The ONS added: "The larger contraction of the UK economy primarily reflects how lockdown measures have been in place for a larger part of this period in the UK compared with these other economies. The coronavirus pandemic and the response to it has impacted the global economy, with record declines recorded in all of these countries."
It comes after yesterday ONS data showed around 730,000 UK workers have been removed from the payrolls of British companies since March when the coronavirus lockdown began in a sign of the toll taken on the economy by the pandemic.
The largest recession ever recorded
ONS
Jonathan Athow, deputy national statistician at the ONS, said: "The recession brought on by the coronavirus pandemic has led to the biggest fall in quarterly GDP on record.
"The economy began to bounce back in June, with shops reopening, factories beginning to ramp up production and house-building continuing to recover.
"Despite this, GDP in June still remains a sixth below its level in February, before the virus struck.
"Overall, productivity saw its largest-ever fall in the second quarter. Hospitality was worst hit, with productivity in that industry falling by three-quarters in recent months."