According to the Oxford English Dictionary a donjon is "the main tower within the walls of a medieval castle or fortress". However, Donjons were not always constructed within a medieval castle's walls - there are medieval castles still to be seen today that have a donjon built in the curtain wall itself and also some with a donjon even outside the curtain wall.
Here are some examples:
Donjon positioned in the curtain wall - Kenilworth Castle, England
Donjon positioned outside the curtain wall - Castillo de Bellver, Mallorca
In architectural terms, donjons are essentially rectangular keeps which also, because of the nature of their construction, were able to serve as fortified dwelling houses. Initially, they were built by the Normans in France - such as the medieval donjon which we visited and whose medieval garden was a joy to behold.
After 1066 donjons were subsequently introduced into England. A good example of a Norman Donjon in England is the famous White Tower at the Tower of London.
Usually between 2 and 4 storeys high, donjons were very solidly built and with thick walls generally strengthened by buttresses. The engine stall was usually on the second floor being reached by a stairway built against the side of the keep and internally there were spiral stairways usually in the corners.