The strategic position and mild climate favored settlements since antiquity; in Roman times there was a port called Fritum Janii, used by the town of Tibula, whose location is still unknown. After the fall of the Roman Empire and the beginning of the Judges rule, a large part of the territory was included among the possessions of a number of monasteries, such as the benedictine abbey of Tergu, and a more ancient convent on mount Frigiano. In 1102 the Doria family from Genoa built a castle in the place, calling it Castelgenovese, and the population moved inside the walls. The castle was never conquered in the course of the centuries. In the early 16th century the name was changed into Castel Aragonese and finally, when Sardinia passed under the Savoy, to Castelsardo.
In the 19th century there was a decline of the economy and a large part of the population emigrated. In more recent times however, tourism is giving a growing impulse to the territory and the economy.