As a consequence of the 1801 Treaty of Lunéville, the Bishopric of Würzburg was secularized in 1803 and granted to the Electorate of Bavaria. In the same year Ferdinand III, former Grand Duke of Tuscany, was compensated with the Electorate of Salzburg. In the Peace of Pressburg of 26 December 1805, Ferdinand lost Salzburg to the Austrian Empire, but was compensated with the Würzburg territory, Bavaria having relinquished it in return for Tyrol.
Ferdinand's state was briefly known as the Electorate of Würzburg (Kurfürstentum Würzburg), but it was elevated to the status of a Grand Duchy after the dissolution of the Holy Roman Empire on 6 August 1806. It joined the Confederation of the Rhine on 30 September 1806. In 1810 it acquired Schweinfurt.
After Napoleon's defeat at the Battle of Leipzig, Ferdinand dissolved his alliance with the First French Empire on 26 October 1813. Through an Austrian-Bavarian treaty of 3 June 1814, Ferdinand lost his possessions to the Kingdom of Bavaria and the Grand Duchy was dissolved. Ferdinand was restored to a reconstituted Grand Duchy of Tuscany by the Congress of Vienna. The Roman Catholic Diocese of Würzburg was reestablished in 1821 without temporal power.