The oldest town centre was surrounded by walled fortifications, probably already by the 7th century. The town was divided into districts designated after the town gates: Miljska (Milje), Stolna (Cathedral), Osrednja (Central) and Poljska (Field). As the town expanded, so did the walls towards the southeast, which included the new districts, namely those that were growing outside the walls.
One part of the walls, which surrounded the oldest part of the town near the cape (the first town walls), did not change over the centuries; it needed only to be thoroughly renovated on several occasions. In the final phase of the expansion, at the beginning of the 16th century, the so-called third town walls embraced the entire peninsula. In the meantime, the so-called second town walls had been built and included the Marčano district. The preserved remains of these walls are the first Rašpor gate. The largest part of the preserved walls dates from the beginning of the 15th century and the end of the 16th century and became an integral part of the medieval town structure. The largest preserved section of the walls on the Mogoron hill has exceptional historical value and marks the limit of the medieval town centre.
The town walls were eventually completed between the years 1470 and 1534 and had eight crenellated towers with battlements. The external side of the walls indicates a typical defensive setting with a slight angle. It is also remarkable due to its exceptional height. A few years ago, some parts of the towers and the connecting walkways were renovated, so that today the walls are accessible and can be visited.
The Piran town walls were built gradually, the largest one in the time when the way battles were waged was changing dramatically due to the use of gunpowder, which required new methods of defence. According to its shape, it is obvious that the town's walls were being adapted to the medieval type of defence. Seven town gates, former entrances to the town walls, are still preserved.
First Rašpor Gate, in Gothic style, was built as a part of the town walls. It can be reached from Rozmanova Ulica.
Second Rašpor Gate (still in Rozmanova Ulica) was built in the year 1470. It encloses a compact part of the third walls with seven towers and has a typically pointed arch with still visible stone hinges.
Marčana Town Gate was built in the year 1534. It leads to the street Ulica Svobode. It was built in the Renaissance style and forms a part of the third town walls.
Milje Gate from the 13th century is one of the oldest preserved gates in the town. It gained its name from an old street in the Punta district that led to the sea.
Dolphin Gate (Savudrijska Ulica) is the most beautiful preserved Gothic gate in the town. It was built in the year 1483 by the mayor Dolphin, and is distinguished by the characteristic coat of arms with three dolphins. The gate is also the only one that has preserved its original look – the simple form of a pointed Gothic arch.
Field Gate probably dates from the 15th century. The small church or chapel of St. Jacob once stood nearby and was connected to Loggia and the former Town Hall.
St. George Gate, in Baroque style, is attached to the Court House and so many travellers do not perceive it as a single structure but rather as a part of the Court House. It was renovated in the year 1660. In the year 1991, Piran joined the international association “Friendly Circle of Walled Towns”, which has its seat in the English town of Tenby. It has over 130 members, who meet annually and share their experiences. In the year 1998, the meeting of the mayors of the walled towns was held in Piran.