A novel bismuth-based anode material with a stable alloying process by the space confinement of an in situ conversion reaction for a rechargeable magnesium ion battery.