Castelfiorentino borders the following municipalities: Certaldo, Empoli, Gambassi Terme, Montaione, Montespertoli and San Miniato.
It underwent conflicts between the Church and Empire, Guelphs and Ghibellines and between Siena and Florence itself (of which it was an important outpost, and therefore obtained the seat of the podestà, the privilege of the red lily on the white banner and the official integration of the name Castelfiorentino).
With the plague and the death of Ferrucci, Florence had to surrender to the troops of Carlo V and accept the return of the Medici and with it also Castelfiorentino.
The Valdelsa remained in a state of desolation due to the war events, so much so that the government of Florence relieved those populations of all expenses.
But in the 18th century, with the Grand Duchy of Lorraine, it progressed again and was Chancellery and Podesteria, with civil guard and extensive jurisdiction also over Certaldo and Montaione.