The Duchy of Livonia (Polish: Księstwo Zadźwińskie or Księstwo Inflanckie; Lithuanian: Livonijos kunigaikštystė; Latin: Ducatus Ultradunensis; Estonian: Üleväina-Liivimaa hertsogkond; Latvian: Pārdaugavas hercogiste; German: Herzogtum Livland), also referred to as Polish Livonia or Livonia (Polish: Inflanty) was a territory of the Grand Duchy of Lithuania and later the Polish–Lithuanian Commonwealth that existed from 1561 to 1621. It corresponds to the present-day areas of northern Latvia and southern Estonia.
Livonia had been part of the Grand Duchy of Lithuania from 1561, since the Livonian Order was secularized by the Union of Vilnius and the Livonian Confederation dissolved during the Livonian Wars. Part of Livonia, formed the Duchy of Courland and Semigallia, while the south-west part of today's Estonia and north-east part of today's Latvia, covering what is now Vidzeme and Latgale, were ceded to the Grand Duchy of Lithuania.
In 1566, it was declared as the Duchy of Livonia according to the Treaty of Union between the landowners of Livonia and authorities of Lithuania; Jan Hieronimowicz Chodkiewicz became the first Governor of the Duchy (1566–1578) in Sigulda Castle. It was a province of Grand Duchy of Lithuania until 1569. After the Union of Lublin in 1569, it became a joint domain of the Polish Crown and the Grand Duchy.
The larger part of the Duchy was conquered by Swedish Empire during the Polish–Swedish wars, and their gains were recognized in the Truce of Altmark in 1629. The Commonwealth retained southeastern parts of the Wenden Voivodeship, renamed to Inflanty Voivodeship with the capital in Daugavpils (Dyneburg), until the first Partition of Poland in 1772, when it was annexed by Catherine the Great's Russian Empire. The title "Grand Duke of Livonia" was added to the grand title of later Russian Emperors.