Keys are items used to activate locked doors or switches.
There are two types of key: electronic keycards (usually used for UAC bases) and skull keys (usually used for demonic bases). Attempting to open a locked door without possessing the key of the required color will result in the door not opening, a linedef sound, and a message saying "You need a blue/yellow/red key to open This Door." Once obtained, all doors with that color can be open until the level is reset. All keys are lost upon exiting a map. In deathmatch mode, all keys are removed and you start off with all three keycards and all three skull keys (the skull keys are on top of keycards).
Multiple keys of the same color can be picked up in the same level, the status bar will display whichever last one was picked up, the *idkfa* cheat code (select text between asterisks to reveal) will display skull keys on top of keycards. Mostly, bars are used for keycard pickups and vertically-arranged skulls are used for skull key pickups. However, this is violated at least once (e.g. E2M3: Refinery having keycard pickups but skulls around doors).
Keys, as other things, can change difficulty flags to only appear on certain skill levels. This allows the designer to put the key on higher skill levels to appear in a harder location. For example, in E3M6: Mt. Erebus, the blue skull key appears on a different location depending on the skill level. On ITYTD/HNTR, the key appears right in front of a door. On HMP/UV/NM, it appears inside another building, and that means, there are more monsters on the player's way to the key, including more locations mandatory to visit to actually get to the key. This requires the player to put in more effort to reach the key, the higher the skill level that the map is played on.
- Locked switches were introduced in E4M2: Perfect Hatred where you need the correct key to activate the switch. However it was limited only to doors, so that a remote-control switch that opens another door can be locked, but not for floor/ceiling/lift raising/lowering (or anything like that).
- Some levels have doors that you need multiple keys to open, by simply placing several locked doors in front of each other, first mentioned in E2M6: Halls of the Damned.
The blue keycard appears 11 times total and first appears in E1M3: Toxin Refinery.
The yellow keycard appears 9 times total and first appears in E1M3: Toxin Refinery.
The red keycard appears 7 times total and first appears in E1M2: Nuclear Plant.
The blue skull key appears 15 times total and first appears in E2M6: Halls of the Damned.
The yellow skull key appears 11 times total and first appears in E2M6: Halls of the Damned.
The red skull key appears 12 times total and first appears in E2M6: Halls of the Damned.