Six major libraries including the British Library have begun archiving UK web content including billions of pages from 4.8 million websites, blogs, forums and social media sites.

The British Library, the National Library of Scotland, the National Library of Wales, the Bodleian Libraries, Cambridge University Library and Trinity College Library Dublin will have the legal right to receive a copy of every UK electronic publication.

The libraries will store the content of millions of websites, blogs, e-books and other digital publications.

Under the new regulations, known as legal deposit, the entire UK domain will be covered with an initial focus on 4.8 million websites.

E-journals, e-books and other offline electronically held material on formats like CD-Rom, will also be included.

UK Culture Minister Ed Vaizey said: "Preserving and maintaining a record of everything that has been published provides a priceless resource for the researchers of today and the future."

"So it’s right that these long-standing arrangements have now been brought up to date for the 21st century, covering the UK’s digital publications for the first time," Vaizey said.

The British Library chief executive Roly Keating said: "Ten years ago, there was a very real danger of a black hole opening up and swallowing our digital heritage, with millions of web pages, e-publications and other non-print items falling through the cracks of a system that was devised primarily to capture ink and paper."

"The regulations now coming into force make digital legal deposit a reality, and ensure that the Legal Deposit Libraries themselves are able to evolve – collecting, preserving and providing long-term access to the profusion of cultural and intellectual content appearing online or in other digital formats," Keating said.