
The oldest written evidence of Samobor is The Charter of Bela IV, Croatian-Hungarian king. With this document, after the war with the Tartars, the king acknowledged the privileges given to Samoborians by Archduke Koloman two years earlier. The place of Samobor was thus elevated to the status of "free royal chartered marketplace", with the right of advowson (choosing the priest), electing the judge and administration of justice including the "right of sword" (ius gladii), e.g. the capital punishment. Samobor had no other lords except its own citizens, and paid taxes only to the king.

Around years 1261-1271 The Samobor Castle was build on the hill above the town. It was built by supporters of Bohemian king Otokar Přemisl II in the war over Babenberg heritage. In the year 1274 the castle was taken over by duke Ivan Okichki. The owners of the castle changed often, but they all respected the privileges given by Bela IV, until by mistake in the year 1488 Barbara Frankopan was introduced as the owner of not only the castle but the place itself. The struggle for justice and old privileges lasted for three hundred years and was finally ended by the end of 18 century. Until that time the castle deteriorated to such extent that the owners deserted it. Finally Samobor bought the ruins in 1902.

In the years 1809 - 1813 Samobor was under the French rule as the center of a canton in The Illyrian provinces of Napoleon empire. The French founded the post office in the town and built a road towards Zagreb.

Samobor was one of the more important centers of The Croatian National Renaissance in the first half of 19 century. here lived the composer Ferdo Livadić who in his mansion (The Samobor Museum today) in 1833 set music to lyrics of Ljudevit Gaj for the most famous patriotic song of the period "Croatia has not perished yet". Many peers of the movement were often his guests. So Stanko Vraz, the first Croatian professional journalist and writer, met his Ljubica here, Julijana Cantilly, to whom he dedicated his book of poetry "Djulabije" (Red Apples).

In Samobor The Communist Party Of Croatia was founded in 1937 and Samobor and Žumberak hills were an important center of the partisan antifascist movement during World War II.

In 1797 the town was destroyed by great fire. After the fire the core of today’s Samobor was built.