From the Super Mario Wiki
Retrieved from "http://www.mariowiki.com/index.php?title=Metal_Cap&oldid=2070817"
The Metal Cap is an accessory that makes its debut appearance in Super Mario 64. It is usually found in Metal Boxes. The Metal Cap can turn Mario into Metal Mario, which makes him invulnerable and extremely heavy. The side effects of this temporary invulnerability are that he can no longer make very high or long jumps, cannot swim, and will sink faster in quicksand. Fortunately, while in metal form, Mario is also unaffected by toxic fog, and cannot drown; he also has access to extremely powerful Ground Pounds.
If Mario were to get another power while the Metal Cap is in effect, they will combine; this is possible especially on Dire Dire Docks, where a Metal Box is located directly beside a Exclamation Mark Block. One example is that of a Metal Vanish Cap, which allows Mario to walk through walls while retaining his powers from the Metal Cap. Another is that of a Metal Wing Cap, which gives Mario the ability to fly and, again, retaining his powers from the Metal Cap. Combining all caps together results in a Metal Vanish Wing Cap (or Metal Wing Vanish Cap) that gives Mario all of their powers and the Metal Cap's strength.
In Super Mario 64 DS, the Metal Cap does not appear. Instead, Wario becomes Metal Wario when he grabs a Power Flower, but still retains the same properties as Metal Mario and the music from the Metal Cap is retained.