There are traces of the large-scale settlements in Shaki that date to more than 2700 years ago. The Sakas were an Iranian people that wandered from the north side of the Black Sea through Derbend passage and to the South Caucasus and from there to Asia Minor in the 7th century B.C. They occupied a good deal of the fertile lads in the South Caucasus in an area called Sakasena. The city of Shaki was one of the areas occupied by the Sakas. The original settlement dates back to the late Bronze Age.
Shaki was one of the biggest cities of the Albanian states in the 1st century. The main temple of the ancient Albanians was located there. The kingdom of Shaki was divided into 11 administrative provinces. Shaki had been one of the important political and economic cities before the Arab invasion. But as a result of the invasion, Shaki was annexed to the third emirate. An independent principality was established in tames of a weakened Arabian caliphate. She was also managed by Georgian Kingdom, Atabegs of Azerbaijan and Khwarezmid Empire before Mongol invasion. After the collapse of the Hulakis in the first half of the 14th century, Shaki gained independence immediately after the states of Shirvanshahs and the Orlat dynasty came into power. Shah Tahmasp put an end to the independence of Shaki in 1551 and annexed it to Safavid Iran except Ottoman administration between 1578-1603 and 1724-1735. Then the Shaki khanate was established in 1743, and was one of the strongest feudal states among the Caucasian khanates.
As a result of the flood in the river Kish, the city of Shaki was partially ruined and the population was resettled in the present day city. The Shaki khanate became a vassal of the Russian Empire in accordance with the second Kurekchay Treaty of 1805. The area was fully annexed by Russia by the Treaty of Gulistan in 1813 and the khanate was abolished in 1819 and in its place the Shaki province was established.
During its history, the town was devastated many times and because of that, the oldest historic and architectural monuments currently preserved are dated to only the 16th-19th centuries. For many centuries, Shaki has been famous as the basic center of silkworm-breeding. Originally located on the left bank of the river Kish, the town sited lower down the hill, however Shaki was moved to its present location after a devastating flood in 1772 and became the capital of Shaki Khanate. As the new location was near the village of Nukha, the city became also known as Nukha, until 1960 when it reverted back to the name Shaki.
Shaki is famous for the 18th century Khan's palace and caravanserai.