Magnesium azide is an inorganic chemical compound with the formula . It is composed of the magnesium cation () and the azide anions ().
Magnesium azide hydrolyzes easily. Like most azides, it is explosive.