Consalvi was born in Rome, a descendent of the ancient noble family of the Brunacci of Pisa. The cardinal's grandfather, Gregorio Brunacci, had taken the name and arms of the late Marquess Ercole Consalvi of Rome, as was required in order to inherit the large fortune the original Consalvi had left. He was the son of Mario Giuseppe Consalvi, the Marquess of Toscanella, and Countess Claudia Carandini of Modena. At the death of his father in 1763, Ercole was entrusted to the care of Cardinal Andrea Negroni. He was educated at the college of the Piarists from 1776 to 1771. He then entered the seminary founded in Frascati by the English Cardinal Henry Benedict Stuart, who was also called Duke of York by Jacobites, thus often referred to as "Cardinal York", and who was the Stuart pretender to the throne of Great Britain. He became a favorite of the Cardinal's and was helped by him to obtain high office in the Roman Curia while still a young man.
At the completion of his seminary studies in 1776, Consalvi took minor orders. The years from 1776 to 1782 were devoted to the studies of jurisprudence and ecclesiastical history in the Pontifical Ecclesiastical Academy in Rome, where he had among other professors the Jesuit scholar, Zaccaria. He then began studies in both civil and canon law at La Sapienza University, from which he received doctorates in both fields in 1789. He had become an official of the Papal Court in 1784, serving in various administrative offices (votante di segnatura; auditor of the Rota for Rome) for the next 14 years in Rome, where he was known as Monsignore Ubique on account of his taste for travelling and cultivating interesting people.
After the French Revolutionary Army invaded Italy in 1798, Consalvi was jailed in the Castel Sant'Angelo in connection with the death of General Duphot and condemned to deportation. As an "enemy of the Roman republic" his property was confiscated. But he was soon released and joined Pope Pius VI in exile. An able diplomat, he was nominated after the death of that pope to be secretary of the conclave that met in Venice from November 1799 to March 1800 to choose his successor, and resulted in the election of Pope Pius VII.
Consalvi was created Cardinal-Deacon and named Cardinal Secretary of State by the new pope in the secret consistory of 11 August 1800, receiving the red hat from him in a public consistory on 14 August 1800. On the following 20 October, he was assigned the titular church of Sant'Agata dei Goti (later transferred to that of the Basilica of Santa Maria ad Martyres [Our Lady of the Martyrs], better known as the Pantheon, on 28 July 1817). In his new position of Secretary of State, he immediately left Rome for Paris in June 1801 to negotiate an understanding with the French, that resulted in the Church's Concordat of 1801 with Napoleon. While not effecting a return to the old Christian order, the treaty did provide certain civil guarantees to the Church, acknowledging "the Catholic, Apostolic, and Roman religion" as that of the "majority of French citizens". In Paris he enjoyed a considerable social success thanks to his personal charisma, to which even Napoleon was not immune. Consalvi was highly cultivated and a lifelong devotee of poetry, the arts and sciences, archaeology, and, in particular, music.
Pius VII ordained Consalvi to the subdiaconate and then to the diaconate in his private chapel on 20 and 21 December 1801, respectively. He was never elevated to the sacramental offices of priest or bishop. But he acted as virtual sovereign in Rome during the absence of Pius VII in Paris for the coronation of Napoleon as emperor.
Due to his firm stance against the Napoleonic government and his opposition to the participation of the Papal States in France's Continental Blockade, he was required to resign in June 1806 as Cardinal Secretary of State, from which he went on to serve in various functions of the Curia.
When the French entered Rome in 1808 and formally abolished the temporal power of the pope, Consalvi broke off all relations with the French. When France annexed the Papal States in 1809 and took the pope into exile in Savona, Cardinal Consalvi was forcibly taken to Paris. There he was met by Napoleon himself, who offered him an annual pension of 30,000 francs. This he refused. When he and twelve other cardinals refused to attend Napoleon's marriage to Princess Marie Louise in 1810, they were stripped of their property and ecclesiastical status, becoming known as the black cardinals. Consalvi and the others were also forced to reside in various cities in France, in his case, Reims. This lasted until Pius VII signed the Concordat of Fontainebleau in January 1813. The cardinal was then allowed to leave his place of forced residence and joined the Pope. Consalvi then promptly persuaded Pius to retract the concessions he had made to Napoleon, which he began to do in March of that same year.
In consequence of his role in shifting Pius' position, the French authorities first barred Consalvi from seeing the Pope, then the following January again sent him into exile, this time in Béziers. This exile, however, lasted only a matter of weeks, as he was freed by the French Provisional Government on 2 April 1814, shortly before Napoleon's final abdication. He was then able to rejoin the Pope in Italy, at which time he was reappointed to the office of Secretary of State.
After the fall of Napoleon, he was papal plenipotentiary at the Congress of Vienna and was able to convince the victorious powers to restore the Papal States almost entirely (although the Papacy had been forced to accept the French annexation of Avignon). For the remainder of the pontificate of Pius VII, Consalvi was the virtual ruler of Rome. Consalvi went on to reform the administration of Rome and to some extent modernized the city. He was said to be so much in control of the pope that Pius would have to wait at the gates of paradise until the cardinal came from purgatory with the keys. He concluded another Concordat with France in 1817 and retired when Pius died in 1823. At the time of his own death the following year, he headed the Sacred Congregation for the Propagation of the Faith to which he had just been appointed a few days prior. Although a consummate diplomat and man of the world, Consalvi has been called "one of the purest glories of the Church of Rome" (Schaeffer).
He secured the Protestant artist Thorwaldsen's right to create the burial monument for Pope Pius VII in St. Peter's Basilica in Rome.
Consalvi died in 1824 and is buried in the Church of San Marcello al Corso.Mémoires du cardinal Consalvi (2 volumes)