Changing sides in 1805 he fought for Napoleon, with the result that by the peace of Pressburg in that year he obtained the Breisgau and other territories at the expense of the Habsburgs. In 1806 he joined the Confederation of the Rhine, declared himself a sovereign prince, became a grand-duke, and received other additions of territory. The Baden contingent continued to assist France, and by the peace of Vienna in 1809 the grand-duke was rewarded with accessions of territory at the expense of the kingdom of Württemberg. Having quadrupled the area of Baden, Charles Frederick died in June 1811, and was succeeded by his grandson, Charles, who was married to Stephanie de Beauharnais (d. 1860), an adopted daughter of Napoleon. Charles fought for his father-in-law until after the battle of Leipzig in 1813, when he joined the Allies.

In 1815 Baden became a member of the Germanic confederation established by the Act of the 8th of June, annexed to the Final Act of the congress of Vienna of the 9th of June. In the hurry of the winding-up of the congress, however, the vexed question of the succession to the grand-duchy had not been settled. This was soon to become acute. By the treaty of the 16th of April 1816, by which the territorial disputes between Austria and Bavaria were settled, the succession to the Baden Palatinate was guaranteed to Maximilian I., king of Bavaria, in the expected event of the extinction of the line of Zähringen. As a counterblast to this the grand-duke Charles issued in 1817 a pragmatic sanction (Hausgesetz) declaring the counts of Hochberg, the issue of a morganatic marriage between the grand-duke Charles Frederick and Luise Geyer von Geyersberg (created Countess Hochberg), capable of succeeding to the crown. A controversy between Bavaria and Baden resulted, which was only decided in favour of the Hochberg claims by the treaty signed by the four great powers and Baden at Frankfort on the 10th of July 1819. Meanwhile the dispute had produced important effects in Baden. In order to secure popular support for the Hochberg heir, Charles in 1818 granted to the grand-duchy, under article xiii. of the Act of Confederation, a liberal constitution, under which two chambers were constituted and their assent declared necessary for legislation and taxation.

The outcome was of importance far beyond the narrow limits of the duchy; for all Germany watched the constitutional experiments of the southern states. In Baden the conditions were not favourable to success. The people, belonging to the "Celtic fringe" of Germany, had fallen during the revolutionary period completely under the influence of French ideas, and this was sufficiently illustrated by the temper of the new chambers, which tended to model their activity on the proceedings of the Convention in the earlier days of the French Revolution. On the other hand, the new grand-duke Louis, who had succeeded in 1818, was unpopular, and the administration was in the hands of hide-bound and inefficient bureaucrats. The result was a deadlock; and, even before the promulgation of the Carlsbad decrees in October 1819 the grand-duke had prorogued the chambers, after three months of sterile debate. The reaction that followed was as severe in Baden as elsewhere in Germany, and culminated in 1823, when, on the refusal of the chambers to vote the military budget, the grand-duke dissolved them and levied the taxes on his own authority.

In January 1825, owing to official pressure, only three Liberals were returned to the chamber; a law was passed making the budget presentable only every three years, and the constitution ceased to have any active existence.

In 1830 Louis was succeeded as grand-duke by his half-brother Leopold, the first of the Hochberg line. The July Revolution led to no disturbances in Baden; but the new grand-duke from the first showed liberal tendencies. The elections of 1830 were not interfered with; and the result was the return of a Liberal majority. The next few years saw the introduction, under successive ministries, of Liberal reforms in the constitution, in criminal and civil law, and in education. In 1832 the adhesion of Baden to the Prussian Zollverein did much for the material prosperity of the country. With the approach of the revolutionary year 1848, however, Radicalism once more began to lift up its head. At a popular demonstration held at Offenburg on the 12th of September 1847, resolutions were passed demanding the conversion of the regular army into a national militia which should take an oath to the constitution, a progressive income-tax and a fair adjustment of the interests of capital and labour.

The news of the revolution of February 1848 in Paris brought this agitation to a head. Numerous public meetings were held at which the Offenburg programme was adopted, and on the 4th of March, under the influence of the popular excitement, it was accepted almost unanimously by the lower chamber. As in other German states, the government bowed to the storm, proclaimed an amnesty and promised reforms. The ministry was remodelled in a more Liberal direction; and a new delegate was sent to the federal diet at Frankfort, empowered to vote for the establishment of a parliament for united Germany. The disorders, fomented by republican agitators, none the less continued; and the efforts of the government to suppress them with the aid of federal troops led to an armed insurrection. For the time this was mastered without much difficulty; the insurgents were beaten at Kandern on the 20th of April; Freiburg, which they held, fell on the 24th; and on the 27th a Franco-German "legion," which had invaded Baden from Strassburg, was routed at Dossenbach.

At the beginning of 1849, however, the issue of a new constitution, in accordance with the resolutions of the Frankfort parliament, led to more serious trouble. It did little to satisfy the Radicals, who were angered by the refusal of the second chamber to agree to their proposal for the summoning of a constituent assembly (10th of February 1849). The new insurrection that now broke out was a more formidable affair than the first. A military mutiny at Rastatt on the 11th of May showed that the army sympathized with the revolution, which was proclaimed two days later at Offenburg amid tumultuous scenes. On the same day (13th of May) a mutiny at Karlsruhe forced the grand-duke to take to flight, and the next day he was followed by the ministers, while a committee of the diet under Lorenz Brentano (1813-1891), who represented the more moderate Radicals as against the republicans, established itself in the capital to attempt to direct affairs pending the establishment of a provisional government. This was accomplished on the 1st of June, and on the 10th the "constituent diet," consisting entirely of the most "advanced" politicians, assembled.