In the Piran area the original settlers were Illyrs, who were 178 B.C. evicted by Romans, who in turn settled down in these parts. Here several Roman villas (villa rustica) were constructed, also there are more archaeological finds. During the Roman decline period (after 4th century A.D.) a more populated settling begins, near the sea fortified strongholds against barbarians were constructed. From written records it may be ascertained that Piran is mentioned as heavily fortified »castrum« of the Byzantine empire in the 7th century. After the year 600 A.D. these areas commence to be settled by Slavs. In the 8th century this constituted a part of the Frankish state who ousted the Byzantines from Istria in the year 787. The Franks settled in the emptied and abandoned ground of Istria Slovenians from Carniola and north littoral province.
In the 9th century it was annexed by the Italian kingdom, and then in the year 952 was under the German empire, later the rule in Istria and Piran belonged to the patriarch of Aquilea. The town became an independent feudal estate and had fortified defence walls, which were later extended (from vegetables market of today until present day end of Tartini square – where one of the towers is still visible). Autonomous tendencies began to spread, as the Aquilea representative only collected taxes and was not bothered with the upholding of order and settled life. In this period (in 1278) the salt pans are mentioned for the first time in the parchment records, the salt trade itself was then connected with the tendency to acquire liberty and new rights. Again the might of Venetians prevails and their rule is established in Piran (after a brief war from 1282 until 1283). Nevertheless it achieved a special status of liberties and thus managed to strengthen. During this period many important buildings were built (old municipal building in 1292, grain and flour storage warehouse in 1302, St. Francis church in 1318, Loggia – today Café Tartini in 1324, St. George cathedral in 1343, town walls from the 12th to 15th century with later additional constructions… In the 14th century Piran boasted a school for nobles and rich citizens and that school is one of the oldest in Slovenia. Piran nursed in the middle ages also considerable land appetites, and was thus in frequent bloody battles with the neighbouring towns of Buje and Izola, so much so that even the Venetian Doge was forced to intervene between the sides. In the year 1797 the Venetian supremacy ends and Napoleon sent here Austrian troops (until 1806), but no lasting influence was exercised by them except for construction of outer harbour. The same was under the French (from 1806 until 1813).
In the Austrian Habsburg monarchy (from 1813 until 1918) the town of Piran flourished experiencing welfare: the salt pans were enlarged, the smelly inner harbour was filled in – now Tartini Square, the crafts and trade also prospered, tourists started coming. Piran had in that period about 13,000 inhabitants (Koper 10,000), it had four breweries … In the year 1909 one of the first tramways without rails in the world was established, representing the connection to the narrow railway which linked up the coastal towns between Triest and Poreč. The renovated tram was in operational service until the year 1953.
After the first world war Piran came under the rule of the Italian state. Its cultural and economic condition weakened. Nevertheless, a one significant intervention in that period represented the fortification of the coast around the town, as in those days the sea reached to the houses walls. After the second world war and the Paris peace conference Piran and the area of »Zone B« - from Koper to Novigrad was allotted to Yugoslavia, and after the secession in the year 1991 Piran belongs to the Republic of Slovenia.