The architecture of Scotland in the Middle Ages includes all building within the modern borders of Scotland, between the departure of the Romans from Northern Britain in the early fifth century and the adoption of the Renaissance in the early sixteenth century, and includes vernacular, ecclesiastical, royal, aristocratic and military constructions. The first surviving houses in Scotland go back 9500 years. There is evidence of different forms of stone and wooden houses exist and earthwork hill forts from the Iron Age. The arrival of the Romans led to the abandonment of many of these forts. After the departure of the Romans in the fifth century, there is evidence of the building of a series of smaller "nucleated" constructions sometimes utilizing major geographical features, as at Dunadd and Dumbarton. In the following centuries new forms of construction emerged throughout Scotland that would come to define the landscape.
Medieval vernacular architecture utilised local building materials, including cruck constructed houses, turf walls, and clay, with a heavy reliance on stone. Medieval parish church architecture was typically simpler than in England, but there were grander ecclesiastical buildings in the Romanesque and Gothic styles. From the early fifteenth century, the introduction of Renaissance styles included the selective use of Romanesque forms in church architecture, as in the nave of Dunkeld Cathedral. Castles arrived in Scotland with the introduction of feudalism in the twelfth century. Initially these were wooden motte-and-bailey constructions, but many were replaced by stone castles with a high curtain wall. In the late Middle Ages, new castles were built, some on a grander scale, and others, particularly in the borders, as simpler tower houses. Gunpowder weaponry led to the use of gun ports, platforms to mount guns and walls adapted to resist bombardment. There was a phase of Renaissance palace building from the late fifteenth century, beginning at Linlithgow.