The Sopron Basin and the hills and highlands around it have been inhabited since the VIth century B.C. due to their advantageous location. Remains of settlements protected by ditches from 2500-1900 B.C. during the Chalcolithic period can be explained by the junction of commercial roads which ran in the neighbourhood (Amber road). Tools and jewels are the proof for the presence of tribes that were settled here during the Bronze Age.

The first permanent settlement was established by Celtic tribes, probably around the 9th-8th century B.C. This settlement was located at the present Bécsi Hill at the bank of Ikva stream.

According to our knowledge, the first real castles, fortifications of soil appeared in the 6th-4th centuries B.C. (Iron Age). The age is referred to as the religion of Hallstatt-age. The plateau of Várhely (Burgstall, 483m) was a fortified settlement of Illyrians in the Hallstatt-age. Around 350 B.C. the area was occupied by the Celts. The building of fortifications and ditches was continued after the first appearance of the Romans; their final length reached 2000m. Similar fortifications were built at today's Károly-magaslat (Károly-hill). From the 2nd century B.C. onwards these strongholds were also fixed by stonewalls from the outside.

On Bécsi-hill remnants of another settlement were found. The ruins originate in the La Tène-age, and the settlement probably had a fort as well. The religion of the people contained similar elements to the Ethrusk-Greek system of goddesses who wove and cut the thread of life. Representations of these goddesses were found here. The edifices were dug into the ground. They had a form similar to a hole or a trench, and were supported by piles.

The real development of the settlement was a result of the arrival of the Romans to the bank of the streams Ikva and Rák during the reign of Tiberius (14-37). First they established a settlement on the nearby hills but later they also occupied the area of today's downtown (Oppidum Scarbantia Iulia). The centre (Forum) was where the Main Square lies today around which citizens’ houses were built. The Amphitheatre on Bécsi-hill (2nd century), the cemetery (on the St. Michael-hill) and the pottery workshops (today's Paprét) also belonged to the settlement. The Capitolium (the area of the City Hall) and the Basilica (the venue of judicature and commercial transactions) belonged to the Forum (the Basilica was located where now the Pharmacy House and the Gambrinus house stand).

The Roman Scarbantia was located at the junction of the Amber Road (North-South direction), and the road between Arrabona (Győr) and Vindobona (Vienna) (East-West direction). By this time, the filling up of the boggy areas, and construction using piles had already started between the streams Ikva and Rák. The Romans who also brought their art and culture, did not establish a military base, but created a mainly civilian town the inhabitants of which were mostly merchants and veterans.

During the reign of Vespasianus between 69-79A.D. the city became a municipium (a city with own public administration and inhabitants with full civil rights): Municipium Flavium Augustum. The ruins of 73 villas were found in the area: the remnants of villa-farms which were involved in the cultivation of wine grapes, handicrafts production and commerce.

The commerce of amber-stone became increasingly important in the 1st-2nd centuries. It was then that the artistically chiselled amber-stones appeared as commercial objects. At first, the picture of the city was of one loosely built; it was probably composed of a main road crossing the area diagonally and a number of streets perpendicular to it. The townscape was planned only around 50 A.D. (at the time of Vespasianus) but this was preceded by the building of an elliptic fortress. The two entrances of the fortress coincided with today’s Előkapu (Front Gate) and Hátsókapu (Back Gate) and the walls were fortified by several bastions. The main axis of the ellipse corresponded to the direction of the Amber Road. The pattern of the streets in the inner city took up the form in which they are visible today.

It is highly probable that at the time of the building of the castle the formation of another city-core had already started. This was located around the area of the St. Michael church, where at that time there was a Roman cemetery. Scarbantia also had a Paleochristian minority at that time and the settlement also was the seat of their episcopate. It was here that they built the first Christian church of Sopron and the former Roman cemetery later became a Christian one.

Signs of the early tribal migrations (Migration Period) can be traced in Sopron as well. The first phase was marked by the Germanic Quads, which was called the Foederati age (375-433). The second phase was the age of the Huns (especially remarkable in Eastern Pannonia). This period was followed by that of the Eastern Goths (455-471). The "Sveb heruls" is mentioned as the fourth age and lastly the Lombard age followed (526-586). Afterwards, when the Avars forged ahead (568), the fortress became uninhabited. There is an account about escaping Christians and some of the Romanised inhabitants still lived here sparsely up until 568. The castle then perished. The place gradually lost its significance as there were no borders in the neighbourhood at that time.

The significance of the area was not improved by the Franc invasion either, when Charles the Great stretched the borders of his empire to the river Rába. Hence, all territories lying to the North and West of the Rába became Franc territory. Because of the continuous attacks of Franc and Bulgarian tribes, the Avar empire which was already weakened from inside, was bound to collapse. Around that time the Francs adopted cristianity and a sort of feudal system formed in their society and new border guard fortresses were built. An important find from this period is the so-called Cunpald chalice.

After the Hungarian Conquest (about 900), the new county-system was established in the area. Sopron county was accorded to Prince Súr. At that time the Roman walls of the settlement were still 5-6m high. The genus Osl (Osli) were the descendants of the Súrs in medieval times and that is the reason why several settlements in the neighbourhood of Sopron today bear the name of heads of the Oslis.  The borders of the Hungarian empire reached the river Enns. This was the period of "roams" or raids, which usually started out from Western Hungary. Silver coins that appeared after the taxation of Italian and Western areas, were found here as well. After the Hungarian conquest, considering the continuous offensives of Barbarian tribes, King Stephen built a border fortress on the ruins of the former fortress of Scarbantia in order to protect the roads and forego the offences. The King re-established the border line at the Leitha.

An enormous fire ruined the castle around 1030 and 1074: the wooden structures providing the protection of archers and catapults must have reached the lower parts of the walls, where the wooden piles stood.

The construction of houses started within and at the foot of the castle walls and the line of the streets followed that of the walls: this resulted in an elliptic town centre with two squares: the Main Square (the former Forum) and the Salt Market (today’s St. Ursula Square).

The early existence and significance of the castle is proven by the fact that according to the chronicle, when giving them their itinerary in 1096, King Clement authorised the crusaders of Gottfried Bouillon to cross the castle of Sopron. "Castellum Cyperon" (Sopron) is expressly mentioned in the agreement. The castle itself was a comital seat (the name Sopron itself probably comes from the first comes of the town, Suprun), and was attended by the villages nearby.

The ecclesiastic remnants of the city also give some hints about the history of the town. The earliest churches of the settlement were built on the Bécsi-hill probably because inhabitants were able to survey the main road (the former Roman road) from up there. The churches of St. John, St. Michael and the chapel of St. Jacob were all built here. Following the reconquest of the castle in 1247, Béla IV made the Knights Hospitaller settle here so as to protect the town from the side of the Bécsi gate.

In 1265 the chief in charge of the castle was comes Peter. Between 1253 and 1278 King Otakar II of Bohemia occupied the castle several times and in order to ensure the town’s fidelity, he took the children of Sopron's nobility with him as hostages. The city opened its gates though, when the army of King Ladislaus IV of Hungary arrived in 1277. The king rewarded Sopron for its fidelity by granting it the rank of free royal town and giving them border guard royal archers. The construction of the outer city walls dates from that time.

The privileges of Sopron (formerly given by Béla IV and Stephen V) were reinforced: the half of the toll of lake Fertő is to remain for them, so as to enable the proper maintenance of the gates and towers of the castle. Some royal domains were also attributed to Sopron. The inhabitants of Sopron no longer had to proceed to the royal comes for justice; their own judges were now entitled to rule in major criminal cases as well and the decima (tax of 1/20) of the town could be used for the maintenance of the walls. The citizens were also entitled to build towers for the protection of the city. It is also Ladislaus IV who prohibited settlement outside the walls and ordered that all who had already settled outside the city walls should - upon loss of their estates - move into the city (intra muros). This decree marks the appearance of new (probably German) settlers in the area, and the establishment of the Újteleki distrtict outside the walls.

Between 1277 and 1360, the former royal limes-fortress became a flourishing free royal merchant town in which the German inhabitants gradually became a majority. In 1339 Charles I supported the building of the town's fortifications by giving the half of the toll collected at the Lake Fertő for another two years to the citizens. The expenses of the regular maintenance of the castle was a heavy burden on the citizens of Sopron, so they applied for tax allowances at the king. King Sigismund ordered John, the bishop of Győr, to give the regular decima (tax of 1/20) to the city in order to provide financial support for the maintenance of the castle walls. In August of the same year, a decree was adpoted according to which the town would receive 200 Forints out of the 1/30 tax of Sopron, also to help the maintenance of the walls and the trenches.

Sopron was one of the seven Free Royal Towns, so the city's chancellery and archives were established accordingly. The first census for the number of houses dates from 1379. After 1379 the area which lay outside the core but within the outer walls was divided into four quarters (viertel= quarter, the four suburbs of today). These quarters were divided into four further smaller districts. The Outer Committee, a college of the town which had 24 members, thus consisted of 8 citizens from the centre, and 4x4=16 citizens from each of the suburban districts. By this time, the population of the town was probably around 2100-2300 people, but by 1427 the number of inhabitants rose significantly, up to 4000.

In 1440 Elizabeth, the widow of King Albert fled to Sopron with her baby son, Ladislaus V and her court. The next year the town was forfeited to the German King Friedrich III, in spite of protests by the league of Free Royal Towns to which Sopron also belonged. In 1447 the German king, Friedrich IV ordered the citizens of Sopron to complete the building of the balustrade (hiernweer) at the lower wall-strait (zwinger). It was in that year that the first guilds appeared in Sopron, which – at least in the beginning - not only meant representation of interests, but also guaranteed financial and moral support for poor members. There appeared another type of guild, the so-called "clerical guilds" the purpose of which was purely to support religious life of members. The oldest of these is the St. George Company which all priests and city councillors were bound to enter, so the company finally held both the profane and religious executive power up to the beginning of the 1550s.

During the reign of King Matthias Corvinus, the walls of the castle were again getting ruinous. It was him who finally managed to redeem the town in 1463 and a year later ordersed the inhabitants to repair the ruinous walls and urged the nobility to help them with their work. In 1469 King Matthew authorised the town have 100 forints out of the Crown toll of Sopron every year, so as to help the building of castle walls and towers.

In a decree adopted in Buda in 1477, he let the City Council know that he had ordered his troops lying near Sopron to amend and fortify the castle of Sopron. The castle and the town played an important role during Matthias's war against the German emperor, and was ruined during this period. To re-build the ruined parts, in a decree of 1483 the king allocated further resources (tax alleviation) for the fortification of the town.

The successor of Matthias, King Vladislaus II also adopted several measures to ensure the financial and human resources background of the fortificaton of Sopron castle. The renovation works must have been finally finished around 1526, as King Louis II then informed the royal treasurer, János Dóczi and the authorities of the Comity Sopron as well as the royal tax-collectors that the town was exempted from all tolls and taxes for one more year, to complete the strengthening of the castle walls properly.

After the reign of King Matthias, however, the castle of Sopron basically lost its military significance. The triple castle walls, first depicted on a map of 1597 are the results of hundreds of years' of development. The big roundel was finished in 1631; a similar tower was built behind the Ursula convent. In 1641 a five-angled, Italian style tower was built at the South-Western corner of the castle.

As the fire-arms appeared, the former walls designed to old military equipments (archers, etc.) did not provide protection any more. Thus, the holes of the old walls were adjusted accordingly, enabling the soldiers to use the new military technologies. The castle trench was filled with the water of the stream Rák.

In 1524 the reformation appeared in Sopron, for the first time in the country. In spite of the auto-da-fes, the majority of the citizens soon converted to Lutheranism. In 1526 the Jews were expelled of the city.

In 1529 the Turks ravaged the suburbs, so the building of an up-to-date defence system came on the agenda once more. As the offensive fire-arms became more and more efficient and their range increased, the neighbouring heights (especially the St. Michael hill) were of great disadvantage for the defence of the city. Involving the St. Michael hill in the defence system would have meant such expenses for the constantly indebted Habsburg emperors, that they chose not to undertake this investment. Thus, when building the Western defence system of castles, the Military Council of Vienna did not modernise the castle of Sopron. Despite all this the Sopron finally did not fall under Turkish rule. Many people from the occupied areas fled to Sopron, and the city's importance grew progressively; it became the centre of the territory free of thraldom. In 1553, 1622, 1625, 1635 and 1681 parliamentary sessions were held in the town.

In 1605, the troops of prince Bocskai desolated Sopron. The citizens therefore undertook to fortify the walls and gates again. Before the Easter of 1617 the Chronicles mention several restoration of walls, pre-eminently at the gates. However, the chronicle states clearly, that the outer walls next to the gates were first established by Mayor Lackner, in 1617. After the building of the castle wall around the downtown had been finished, it took a longer time for the triple system of walls with all the towers to develop and for other settlements (quarters) outside the trenches to have fences made of stones around them. In the triple system of walls the one in the middle was most fortified with densely placed, circular towers. The inner walls could have been 5-6 metres higher than those of the wall-straits.

During the late XVIIth century a plague epidemic killed half of the population of Sopron. In 1676 a huge fire devastated the city and most of the houses possessed by the nobility who started to seek protection inside the walls, were damaged. A new town was born in the next few decades, when beautiful Baroque buildings were built in place of the medieval houses. It was in that period that the Firewatch tower was erected. Sopron became seat of the comitatus Sopron.

By the end of the 17th century, when the Ottomans left the country, one of the main commercial roads (trade of horses and cattle) crossed Sopron. At the beginning of the 18th century the town belonged to the first ten of Hungary. The trade of typography, the moulding of canons and church bells appeared, traditional “blue-painting” flourished. The castle trenches were filled up; little vegetable-gardens developed instead. The development of the Várkerület (Castle circle) was also completed.

In 1753 the first colliery of the country was discovered and opened, thanks to the first steam-driven conveyor. After 1775 the right of citizenship could also be possessed by inhabitants who did not own a house. After 1786 Sopron gradually became a town in spite of the fact that it still was the seat of Sopron county. The number of the inhabitants was more than 11 000 by this time.

In 1835, the Greatest Hungarian, count István Széchenyi became a honorary citizen of the town. He established a steam-driven mill in 1842, and saving banks with the help of the German merchants. After 1840 the formerly expelled Jews were allowed to return to town. By this time, the town had expanded beyond the four Viertels, towards the outer districts beyond the walls erected by Lackner in the XVIIth century. These areas were called Front-town (Vorstadt), in order to distinguish them from the quarters inside the outer walls.

During the revolution of 1848, the town did not play a significant role. In the same year Sopron was compassed by the troops of Windischgrätz and following the suppression of the revolution, the town became the centre of the Trans-danubian District (the financial, military and constabulary affairs of nine former counties were managed from here). In 1850 the City Council was dissolved and, as a consequence only Brennberg remained under the administration of Sopron. The railway between Sopron and Nagykanizsa was established; however, the city did not lie on the railway line connecting Budapest and Vienna.

After the establishment of the Austro-Hungarian Empire, Sopron re-gained her position as county capital. At the end of the XIXth century, the capitalistic development of the town started inside the Monarchy, which was interrupted by the First World War and the proclamation of the Republic of Councils. In 1919, a significant portion of Western Hungary was awarded to Austria by the Treaty of Saint-Germain-en-Laye.

As a result of a referendum held on 14 December 1921 (antedated by the battle of Ágfalva), Sopron and the area around it remained Hungarian territory and the town received the prestigious title of "Civitas Fidelissima" (the most allegiant town). (According to some historians the town already acquired this acknowledgment in the decree of Ladislaus IV in 1277, and the title of 1921 was only a renewal of the former one, but the mentioned medieval decree does not refer to the term "Civitas Fidelissima").

The fact that Sopron became a border town had serious economic consequences during the interwar period. The town tried to countervail these detrimental conditions by developing the textile-industry and tourism. On the 19th March 1944 Sopron was invaded by the German troops. On Near New Year's Eve of the next year the city suffered heavy bombardments. On 31 March 1945 the Soviets reached Sopron.

During the post-war years most of the German-speaking population was evacuated. In 1950 Sopron lost her rank of a county seat. As the town was located in the so-called "border-line", it could only be visited with special permission during the Socialist era. The Iron Curtain was in the neighbourhood, so the harassments of visitors on trains, public roads, etc. was a regular inconvenience.
In the course of the years, the artificially boosted industry gradually regressed, the mines around the area were closed. This process evolved partly consciously, partly because of the town's vague accessibility, so it became rather culture-orientated. Luckily, the Baroque old town was preserved so the town well deserved the Award of European Monument Protection in 1975. Sopron tried to maintain itself by the means it was able to: through regular cultural events (Festive Weeks of Sopron) it could show her hidden beauties to the visitors.

On 19 August 1989 the so-called Paneuropean Picnic was held in Fertőrákos, when the barbed wire of the iron curtain was finally cut. Hundreds of East-Germans fled through the border to Austria. In the decade after the changes the town became that of guest-workers, of shopping tourism and services. Sopron nowadays thrives to become the venue of the high quality tourism, entertainment, wine-growing and conferences.