Kobarid is known for the 1917 Battle of Caporetto, where the Italian retreat was documented by Ernest Hemingway in his novel A Farewell to Arms. The battle is well documented in the museum in the centre of Kobarid. The museum won a Council of Europe award in 1993.
Kobarid was attested in written sources as Kauoretum in 1184 (and as de Cavoreto in 1258, Caboret in 1291, and de Chiavoretto in 1343). The Slovenian name is derived from *Koboridъ, borrowed from Old Friulian *Kaborệdu. The original Romance form of the name, *Cap(o)rētum, is probably derived from Latin caper 'goat' and refers to a place where there are goats. The town is known as Cjaurêt in Friulian, Karfreit in German, and Caporetto in Italian.
The municipality is the westernmost in Slovenia, situated within the Julian Alps in the Upper Soča (Isonzo) Valley, at the confluence with the Nadiža (Natisone) River, close to the border with Italy. In the southwest, the road leads to the neighbouring Italian comune of Pulfero. The area is located in the north of the historic Goriška region, itself part of the larger Slovene Littoral.
Kobarid has been inhabited since prehistoric times. Archaeological remains from the Hallstatt period have been found in the area. The nearby Tonocov Grad archaeological site has remains of 5th-century Roman buildings, when the area was located in the forefront of the Claustra Alpium Iuliarum defense system. The settlement was an important base on the Roman road from Forum Iulii (present-day Cividale del Friuli) up to the Predil Pass and the Noricum province.
In the 6th century, the area was settled by Slavic tribes, ancestors of the modern Slovenes. When Kobarid was first mentioned in 1184, it was part of the Patria del Friuli ruled by the Patriarchs of Aquileia.
While the estates in the west were gradually conquered by the Republic of Venice until 1420, Kobarid together with Tolmin County and the possessions of the Counts of Gorizia was incorporated in the Inner Austrian territories of the Habsburg Monarchy, like the Slovene-speaking territories of Carniola and Lower Styria.
From 1754 Kobarid belonged to the newly established Princely County of Gorizia and Gradisca, a Habsburg crown land which later formed the Austrian Littoral together with the March of Istria and the Imperial Free City of Trieste.
With the exception of a brief period between 1809 and 1813, when it was included under the Napoleonic Kingdom of Italy, Kobarid remained under Austrian rule until 1918. In the mid-19th century, the town became an important centre of the Slovene national revival.
At the outset of World War I, the area saw one of the first victims of the conflict: Countess Lucy Christalnigg, killed by Landsturmer guards during a mission for the Red Cross. During the war, the whole area was the theatre of the Battles of the Isonzo, fought between the Kingdom of Italy and Austria-Hungary. The town was almost completely destroyed between 1915 and 1917.
After the end of the war in 1918, Kobarid was occupied by the Italian Army, and upon the 1919 Treaty of Saint-Germain-en-Laye it was officially annexed to Italy and incorporated into the Julian March region. Kobarid was a comune of the Province of Gorizia (as Caporetto), except during the period between 1924 and 1927, when the Province of Gorizia was abolished and annexed to the Province of Udine. Between 1922 and 1943, Kobarid was submitted to a policy of violent Fascist Italianization and many locals emigrated to the neighbouring Kingdom of Yugoslavia. The town became one of the crucial centres of recruitment and activity of the militant anti-fascist organization TIGR, which carried out an underground fight against the Italian Fascist regime. During the Italian administration, Kobarid also became an important symbolic place for the Fascist authorities because of its role in World War I. An Italian military ossuary was built on the hill above the town, and Benito Mussolini visited Kobarid in 1938.
Immediately after the Italian armistice in September 1943, Kobarid was liberated by a Partisan uprising, and became the center of large liberated area of around 2,500 square kilometers, known as the Kobarid Republic, administered by the Liberation Front of the Slovenian People. During this period, almost all Italian families that settled in Kobarid during the 25 years of Italian administration left the town. In early November 1943, Nazi German forces took over the town and established their rule until May 1945, when the town was finally liberated by the Yugoslav People's Army.
In early June 1945, Kobarid came under joint British–U.S. occupation and placed under Allied temporary military administration until the establishment of a final border between Italy and Yugoslavia. The Morgan Line, which divided the Allied military occupation zone from the Yugoslav one, ran just eastwards of the town, along the Soča River.
In September 1947, the Paris Peace Treaties gave the town to Yugoslavia. Several hundred inhabitants, especially from the Breginj area, chose emigration to Italy rather than become citizens of a Communist state.
Kobarid was the site of a mass grave from the Second World War. The Cemetery Mass Grave (Slovene: Grobišče na pokopališču) was located in the town cemetery, right of the entrance, between the first and second rows of graves. It contained the remains of 11 German soldiers that fell at Kolovrat in April 1945. Unlike most mass graves in Slovenia, the graves were well maintained during the communist era. The remains were exhumed in 2000 and re-interred in a common grave at the Žale Cemetery in Ljubljana.
In the 1960s and 1970s, Kobarid emerged as an important tourist center. Light industry also developed.
With the breakup of Yugoslavia in 1991, Kobarid became part of independent Slovenia.Andrej Manfreda (1908–1943), anti-Fascist resistance fighter, member of TIGR
Izidor Pagliaruzzi (a.k.a. "Pinč," 1820–1884), beekeeper
Josip Pagliaruzzi (1859–1885), poet
Andrej Uršič (1908–?), journalist, political activist
Ana Roš, chef at Hiša Franko