At the time of the dissolution of monasteries, official state records and important papers were poorly kept, and often retained privately, neglected or destroyed by public officers. Sir Robert collected and bound over a hundred volumes of official papers. By 1622, his house and library stood immediately north of the Houses of Parliament and was a valuable resource and meeting-place not only for antiquarians and scholars but also for politicians and jurists of various persuasions, including Sir Edward Coke, John Pym, John Selden, Sir John Eliot, Thomas Wentworth.
Such important evidence was highly valuable at a time when the politics of the Realm were historically disputed between the King[specify] and Parliament. Sir Robert knew his library was of vital public interest and, although he made it freely available to consult, it made him an object of hostility on the part of the government. On 3 November 1629 he was arrested for disseminating a pamphlet held to be seditious (it had actually been written fifteen years earlier by Sir Robert Dudley) and the library was closed on this pretext. Cotton was released on 15 November and the prosecution abandoned the following May, but the library remained shut up until after Sir Robert’s death; it was restored to his son and heir, Sir Thomas Cotton, in 1633.
Sir Robert's library included his collection of books, manuscripts, coins and medallions. After his death the collection was maintained and added to by his son, Sir Thomas Cotton (d. 1662), and grandson, Sir John Cotton (d. 1702).
Sir Robert's grandson, Sir John Cotton, donated the Cotton library to Great Britain upon his death in 1702. At this time, Great Britain did not have a national library, and the transfer of the Cotton library to the nation became the basis of what is now the British Library. The early history of the collection is laid out in the introductory recitals to the British Museum Act 1700 (13 & 14 Will. 3 c. 7) that established statutory trusts for the Cotton library:
The acquisition of the collection was better secured and managed by the British Museum Act 1706 (6 Ann. c. 30), under which the trustees removed the collections from the ruinous Cotton House, whose site is now covered by the Houses of Parliament. It went first to Essex House, The Strand, which, however, was regarded as a fire risk; and then to Ashburnham House, a little west of the Palace of Westminster. From 1707 the library also housed the Old Royal Library (now "Royal" manuscripts at the British Library). Ashburnham House also became the residence of the keeper of the king's libraries, Richard Bentley (1662-1742), a renowned theologian and classical scholar.
On 23 October 1731, fire broke out in Ashburnham House, and many manuscripts were lost, while others were badly singed or water-damaged: up to a quarter of the collection was either destroyed or damaged. Bentley escaped while clutching the priceless Codex Alexandrinus under one arm, a scene witnessed and later described in a letter to Charlotte, Lady Sundon, by Robert Freind, headmaster of Westminster School. The manuscript of The Battle of Maldon was destroyed, and that of Beowulf was heavily damaged. Also severely damaged was the Byzantine Cotton Genesis, the illustrations of which nevertheless remain an important record of Late Antique iconography. Mr. Speaker Onslow, as one of the statutory trustees of the library, directed and personally supervised a remarkable programme of restoration within the resources of his time. The published report of this work is of major importance in bibliography. Fortunately, copies had been made of some, but by no means all, of those works that were lost, and many of those damaged could be restored in the nineteenth century. Advances in multispectral photography have enabled imaging specialists at the British Library led by Christina Duffy to scan and upload images of previously illegible Anglo-Saxon manuscripts damaged in the fire. Images will form part of Fragmentarium (Digital Research Laboratory for Medieval Manuscript Fragments), an international collaboration of libraries and research institutions to catalogue and collate vulnerable manuscript fragments, making them available for research under a Creative Commons public domain license.
In 1753 the Cotton library was transferred to the new British Museum, under the Act of Parliament which established it. At the same time the Sloane Collection and Harley Collection were acquired and added, so that these three became the Museum's three "foundation collections". The Royal manuscripts were donated by George II in 1757. In 1973 all these collections passed to the newly established British Library.