Kostenets () is a town in Sofia Province in southwestern Bulgaria, and the administrative centre of the Kostenets Municipality (which also contains a separate village of Kostenets). The town is situated at the foot of Rila Mountain, about southeast of the city of Sofia.