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.

A second template, {{Key}}, is used on work pages to also add a category entry for the work. This version of the template does not add the key category.

An invalidly entered key will display an error message linking to this page.


{{K|C}} → C major
{{K|d}} → D minor
{{K|Eb}} → E major
{{K|F#}} → F major
{{K|bb}} → B minor
{{K|B#}} → Invalid key