MarioWiki:Sandbox

Keys
There are dozens of different keys for castles and fortresses all across Mushroom World.

Super Mario Bros. 2
Super Mario Bros. 2 is the first Mario game with keys and locked Doors. Phantos will always be guarding keys, so until the player drops a key or unlocks a door, a Phanto will be chasing the player. Keys are always in view -- never under a Vegetable.

Super Mario World
In Super Mario World, the Keyholes would turn into a gigantic portal when a key came into contact with it.

Super Mario World 2: Yoshi's Island
In Super Mario World 2: Yoshi's Island and its sequel the keys unlocked doors, but when a castle boss was defeated a large key would appear and act the same as ones in Super Mario World.

Super Mario 64 DS
In the game Super Mario 64 DS, Rabbits steal keys. The first key Yoshi has to obtain unlocks Princess Peach's Castle; only after he catches that first rabbit can he get inside. There are many other rabbits that can be found in the game, but they only unlock minigames. The next keys Yoshi must collect are held by various bosses, and are used to free Mario, Luigi and Wario. Finally, the first two times Bowser is defeated, he will give Mario and his companions key to different floors of the castle.

Luigi's Mansion
In Luigi's Mansion, Luigi had to collect many keys before he could advance to other rooms. They were usually found in Treasure Chests, although some could be found right out in the open.

Mario Party series
Bowser owns various keys in the Mario Party series. These so-called Bowser Keys are usually found in Bowser Mini-Games, and are necessary to escape from Bowser. In earlier Mario Party games, Bowser Keys are simply keys shaped like Bowser's head. In later games, they are engraved with Bowser's likeness.

Super Smash Bros. Brawl
In the Subspace Emissary mode of Super Smash Bros. Brawl, Emissary Keys are found somewhere near locked gates. If the player finds a key and tries to go through the gate while having it in his or her hand, the gate will become unlocked.