The origins of Carboneras lie in the 17th century, following the construction of the castle of San Andrés and the distribution of lands to soldiers who guarded the coast against raids by Berber and Turkish pirates.
In 1583, Felipe II approved the construction of the castle. In 1688 the fortress passed into the property of the House of Alba, and at the time Carboneras began to expand beyond the castle walls.
By the 18th century, the town was developing economically, with farming and fishing the chief industries. In 1813, Carboneras left the municipality of Sorbas and became independent.