The Danevirke or Danework (modern Danish spelling: Dannevirke; in Old Norse; Danavirki, in German; Danewerk, literally meaning earthwork of the Danes) is a system of Danish fortifications in Schleswig-Holstein, Germany. This historically important linear defensive earthwork across the neck of the Cimbrian peninsula was initiated by the Danes in the Nordic Iron Age about AD 650. It was later expanded multiple times during Denmark's Viking Age and High Middle Ages. The Danevirke was last used for military purposes in 1864 during the Second War of Schleswig.
The Danevirke consists of several walls, trenches and the Schlei Barrier. The walls stretch for 30 km, from the former Viking trade centre of Hedeby near Schleswig on the Baltic Sea coast in the east to the extensive marshlands in the west of the peninsula. One of the walls (named Østervolden), between the Schlei and Eckernförde inlets, defended the Schwansen peninsula.
According to written sources, work on the Danevirke was started by the Danish King Gudfred in 808. Fearing an invasion by the Franks, who had conquered heathen Frisia over the previous 100 years and Old Saxony in 772 to 804, Godfred began work on an enormous structure to defend his realm, separating the Jutland peninsula from the northern extent of the Frankish empire. However, the Danes were also in conflict with the Saxons south of Hedeby during the Nordic Iron Age, and recent archaeological excavations have revealed that the Danevirke was initiated much earlier than King Gudfred's reign, at least as far back as 500 AD and probably well before that. Because of its historical importance and testimony to the defense of trade routes in the Viking Age, the Danevirke and the nearby Viking town of Hedeby were inscribed on the UNESCO World Heritage List in 2018.