In 1799 he entered the Society of Jesus, and in 1804 he became a teacher of classics in the college of Naples. After completing his studies at the Collegium Romanum, he lived for some time at Orvieto, where he was engaged in teaching and palaeographical studies. The political events of 1808 necessitated his withdrawal from Rome (to which he had meanwhile returned) to Milan, where in 1813 he was made custodian of the Ambrosian library.
He now threw himself with characteristic energy and zeal into the task of examining the numerous manuscripts committed to his charge, and in the course of the next six years was able to restore to the world a considerable number of long-lost works. Having withdrawn from the Society of Jesus, he was invited to Rome in 1819 as chief keeper of the Vatican Library. In 1833 he was transferred to the office of secretary of the Congregation of the Propaganda; on February 12 1838 he was raised to the dignity of Cardinal. He died at Castel Gandolfo, near Albano, on 8 September 1854.
It is on his skill as a reader of palimpsests that Mai's fame chiefly rests. To the period of his residence at Milan belong:
His edition of the celebrated Codex Vaticanus, completed in 1838, but not published (ostensibly the ground of inaccuracies) till four years after his death (1858), is the least satisfactory of his labours and was superseded by the edition of Vercellone and Cozza (1868), which itself leaves much to be desired.
Although Mai was not as successful in textual criticism as in the decipherment of manuscripts, he will always be remembered as a laborious and persevering pioneer, by whose efforts many ancient writings have been rescued from oblivion.