The first seal of the city from 1878 which calls it Sredets
For the longest time the city possessed a Thracian name, derived from the tribe Serdi, who were either of Thracian, Celtic, or mixed Thracian-Celtic origin.
The emperor Marcus Ulpius Traianus (53 – 117 AD) gave the city the combinative name of Ulpia Serdica; Ulpia may be derived from an Umbrian cognate of the Latin word lupus, meaning "wolf" or from the Latin vulpes (fox).
It seems that the first written mention of Serdica was made during his reign and the last mention was in the 19th century in a Bulgarian text (Сардакіи, Sardaki).
Other names given to Sofia, such as Serdonpolis (Σερδών πόλις, "City of the Serdi" in Greek) and Triaditza (Τριάδιτζα, "Trinity" in Greek), were mentioned by Byzantine Greek sources or coins. The Slavic name Sredets (Срѣдецъ), which is related to "middle" (среда, "sreda") and to the city's earliest name, first appeared on paper in an 11th-century text. The city was called Atralisa by the Arab traveller Idrisi and Strelisa, Stralitsa or Stralitsion by the Crusaders.
The name Sofia comes from the
Saint Sophia Church, as opposed to the prevailing Slavic origin of Bulgarian cities and towns. The origin is in the Greek word sophia (σοφία) "wisdom", which may derive from the Egyptian word sbÅ (𓋴𓃀𓇼𓀜) "teach, learn or wise" provided b oftentimes turns into ph in Egyptian to Greek translations.
 The earliest works where this latest name is registered are the duplicate of the Gospel of Serdica, in a dialogue between two salesmen from Dubrovnik around 1359, in the 14th-century Vitosha Charter of Bulgarian tsar Ivan Shishman and in a Ragusan merchant's notes of 1376. In these documents the city is called Sofia, but at the same time the region and the city's inhabitants are still called Sredecheski (срѣдечьскои, "of Sredets"), which continued until the 20th century. The city became somehow popular to the Ottomans by the name Sofya (صوفيه). In 1879 there was a dispute about what the name of the new Bulgarian capital should be, when the citizens created a committee of famous people, insisting for the Slavic name. Gradually, a compromise arose, officialisation of Sofia for the nationwide institutions, while legitimating the title Sredets for the administrative and church institutions, before the latter was abandoned through the years.
The city's name is pronounced by Bulgarians with a stress on the 'o', in contrast with the tendency of foreigners to place the stress on 'i'. The female given name "Sofia" is pronounced by Bulgarians with a stress on the 'i'.