Rb2MgH4 crystallizes in the orthorhombic Cmcm space group. There are two inequivalent Rb sites. In the first Rb site, Rb(1) is bonded in a distorted rectangular see-saw-like geometry to four equivalent H(1) atoms. In the second Rb site, Rb(2) is bonded to two equivalent H(1) and four equivalent H(2) atoms to form distorted RbH6 pentagonal pyramids that share corners with four equivalent Mg(1)H4 tetrahedra, edges with two equivalent Rb(2)H6 pentagonal pyramids, and  an edgeedge with one Mg(1)H4 tetrahedra. Mg(1) is bonded to two equivalent H(1) and two equivalent H(2) atoms to form MgH4 tetrahedra that share corners with four equivalent Rb(2)H6 pentagonal pyramids and  an edgeedge with one Rb(2)H6 pentagonal pyramid. There are two inequivalent H sites. In the first H site, H(1) is bonded in a 4-coordinate geometry to one Rb(2), two equivalent Rb(1), and one Mg(1) atom. In the second H site, H(2) is bonded in a 3-coordinate geometry to two equivalent Rb(2) and one Mg(1) atom.
Rb2MgH4 crystallizes in the orthorhombic Cmcm space group. There are two inequivalent Rb sites. In the first Rb site, Rb(1) is bonded in a distorted rectangular see-saw-like geometry to four equivalent H(1) atoms. All Rb(1)-H(1) bond lengths are 2.88 Å. In the second Rb site, Rb(2) is bonded to two equivalent H(1) and four equivalent H(2) atoms to form distorted RbH6 pentagonal pyramids that share corners with four equivalent Mg(1)H4 tetrahedra, edges with two equivalent Rb(2)H6 pentagonal pyramids, and  an edgeedge with one Mg(1)H4 tetrahedra. Both Rb(2)-H(1) bond lengths are 2.77 Å. There are two shorter (2.94 Å) and two longer (3.07 Å) Rb(2)-H(2) bond lengths. Mg(1) is bonded to two equivalent H(1) and two equivalent H(2) atoms to form MgH4 tetrahedra that share corners with four equivalent Rb(2)H6 pentagonal pyramids and  an edgeedge with one Rb(2)H6 pentagonal pyramid. Both Mg(1)-H(1) bond lengths are 1.89 Å. Both Mg(1)-H(2) bond lengths are 1.84 Å. There are two inequivalent H sites. In the first H site, H(1) is bonded in a 4-coordinate geometry to one Rb(2), two equivalent Rb(1), and one Mg(1) atom. In the second H site, H(2) is bonded in a 3-coordinate geometry to two equivalent Rb(2) and one Mg(1) atom.