Ads keep the MarioWiki independent and free :)
Some caps in Super Mario 64 give the characters certain special abilities such as:
Mario's Cap can be stolen by Klepto and Ukiki, or blown away by a Fwoosh or the giant Snowman in Snowman's Land. When Mario loses possession of his cap, various unfortunate things may happen such as Bob-ombs popping out of ? Blocks or Mario taking twice as much damage when hit by an enemy. When lost, Mario's Cap can be found by defeating enemies that wear it.
In Super Mario 64 DS, various new kinds of Caps appear and serve a new function. Grabbing a cap allows whomever possesses it to change his appearance and abilities (however, his voice will remain unchanged). In the early portion of the game, those kinds of Caps also act as 1-Up. For example, if Yoshi wears a Mario Cap and takes another Mario Cap, he will be awarded with a 1-Up. However, as Yoshi frees Bowser's various prisoners, more caps will appear and it will be impossible to find two caps of the same color. Yoshi can choose to wear the caps of whatever character was rescued before entering the course.
In Super Mario Sunshine, the Swipin' Stu enemy can steal Mario's cap. If Mario does not get back his cap, his energy will slowly drain until he dies, due to it being so hot (standing in the shade has no effect). Along with wearing his cap, it gains a Mario-esque mustache.