This template formats and displays a key signature for all the major and minor keys up to seven sharps or seven flats. Major keys use upper-case letters; minor keys use lower-case letters. If the note pitch is flattened, the letter b follows the pitch name; if sharpened, the hash character # is used. These characters are formatted into the appropriate musical symbols.
The template also adds the page on which it is used to the Category corresponding to the key; e.g. {{Key|C}} adds the page to the corresponding category.
A second template, {{K}}, returns identical formatting but does not add a Category corresponding to the key.
An invalidly entered key will display an error message linking to this page.
{{Key|C}} → C major {{Key|d}} → D minor {{Key|Eb}} → E-flat major {{Key|F#}} → F-sharp major {{Key|bb}} → B-flat minor {{Key|B#}} → Invalid key