When was the end of castles?
Castles continued to be built and used throughout the medieval period, but gradually their role in warfare and as symbols of aristocratic power changed following the invention and wide spreading of the gunpowder, especially after the 15th century. Castles slowly started to be less essential in military defense, leading to their decline. However, it's difficult to point to a specific end date, many castles remained in use as royal palaces, forts, country houses, or monuments, and some are still serving these purposes today.