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 Mario's Cap and takes another one, he will be awarded with a 1-Up. However, as Yoshi frees Bowser's various castle 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 the Mario 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.
In Super Mario Odyssey, Cappy can take the forms of many different caps that Mario can wear. These caps can be thrown to attack enemies, capture certain characters or objects, and be used as a temporary jumping platform for Mario (among other uses). All caps are aesthetic and have identical abilities (excluding access to certain areas).