Once the Roman settlement of Matutia'or Villa Matutiana, Sanremo expanded in the Early Middle Ages when the population moved to the high grounds. The nobility built a castle and the walled village of La Pigna to protect the town from Saracen raids.
At first subjected to the countship of Ventimiglia, the community later passed under the dominion of the Genoese bishops. In 1297 they sold it to the Doria and De Mari families. It became a free town in the second half of the 15th century, after which it expanded to the Pigna hill and at Saint Syrus Cathedral. The almost perfectly preserved old village remains.
Sanremo remained independent from Genoa for a long time. In 1753, after 20 years of fierce conflicts, it rose against the hegemonical attempts of the Genoese Republic. At that time the latter polity built the fortress of Santa Tecla, situated on the beach near the port. The fortress was used as a prison until 2002. It is now being transformed into a museum.
After the French domination and the Savoy restoration (1814), Sanremo was annexed to the Kingdom of Sardinia. Since the middle of the 18th century, the town grew rapidly, in part due to the development of tourism: the first grand hotels were built and the town extended along the coast. Notable people, such as the Empress Elisabeth of Austria "Sissi", Empress Maria Alexandrovna of Russia, Czar Nicholas II of Russia, Alfred Nobel, and the writer Italo Calvino stayed