In architecture, a keystone is the last wedge-shaped stone, or voussoir, that is set in place when making a masonry arch.
It is sometimes called a capstone for that reason, but the keystone is not simply a finishing stone; it is what makes an arch work by locking all the stones in place. If you built an arch and forgot to put in the keystone, all the other voussoirs would just fall down into a pile on the ground. Although we usually think of an arch in a doorway, arches are also used to create vaulted ceilings and domes. The keystone is the critical part of those arches as well.
To do its job, the keystone need simply have the same wedge shape as the other stones, but it is usually made bigger to stick out at the top in a proud decorative style. To perhaps emphasize its key role and position in the structure, the keystone is often decorated with sculpture or boss.
Arch with keystone (image)
Vault with ornate keystone (image)