The Electorate of Baden was a State of the Holy Roman Empire from 1803 to 1806. In 1803, Napoleon bestowed the office of Prince-elector to Charles Frederick. This only lasted until 1806, when Francis II dissolved the Empire. When the Holy Roman Empire dissolved, Baden achieved sovereignty, and Charles Frederick became Grand Duke.
It was elevated to the Grand Duchy of Baden through the dissolution of the Holy Roman Empire and was a sovereign country until it joined the German Empire in 1871, remaining a Grand Duchy until 1918 when it became part of the Weimar Republic as the Republic of Baden. Baden was bordered to the north by the Kingdom of Bavaria and the Grand Duchy of Hessen-Darmstadt; to the west, along most of its length, by the river Rhine, which separated Baden from the Bavarian Rhenish Palatinate and Alsace in modern France; to the south by Switzerland; and to the east by the Kingdom of Württemberg, the Principality of Hohenzollern-Sigmaringen and Bavaria.