The area of present-day Piran was settled by Illyrian tribes during the pre-Roman era, but historians still do not agree on the origins of its name. Of the competing theories, the one which sounds most plausible to us is that it is derived from pyr, the Greek word for fire, because the peninsula was originally used primarily as a grounds for lighting fires to guide ships to the nearby settlement of Aegida. After a brief war with the local tribes the Romans annexed much of the north-east Adriatic in 178 BC, and steadily colonised the area until the decline of their empire during the 5th and 6th centuries.
In the wake of the Roman's withdrawal, the Byzantines asserted their power in the region for over a century before themselves being driven out by the Franks, which triggered a wave of migration by Slavs from the interior to the coast. As Venice gradually came to power in the north Adriatic, the inhabitants of the cities along the Istrian and Dalmatian coasts signed trade contracts and political agreements with each other and the Venetians in an attempt to maintain their independence. However, during the 13th century Venice finally decided that it would like to have full control of the salt pans surrounding Piran, and launched a short successful war in 1282.
Venetian rule lasted for over 500 years, only coming to an end in 1797 at the hands of Napoleon, but unfortunately for the wee Corsican the Austrians invaded shortly thereafter and held the territory on and off before taking firm control in 1813. During the next hundred years, Piran experienced exceptional prosperity and growth, with many of the town's most notable administrative buildings dating from this period, including the town hall and even Tartinijev Trg, which had previously been the inner harbour.
After World War I all of Istria came under the rule of Italy, which neglected the region leading to significant economic and cultural decline. Following World War II, Piran was included in the zone of Yugoslav military administration, officially becoming a part of Yugoslavia in 1954. It gained independence as part of the Republic of Slovenia in 1991.