Key Signature Calculator

Pick a tonic note, accidental, and mode to find the key signature: how many sharps or flats it uses, exactly which notes are altered, the relative major or minor key, and the enharmonic equivalent (if one exists) using standard circle-of-fifths music theory.

Quick Facts

Order of sharps
F♯ C♯ G♯ D♯ A♯ E♯ B♯
Sharps are always added to a key signature in this fixed order, one at a time.
Order of flats
B♭ E♭ A♭ D♭ G♭ C♭ F♭
Flats are added in the exact reverse of the sharp order.
Relative keys
Share one signature
Every major key and its relative minor (a minor third lower) use identical sharps or flats.

Your Results

Calculated
Key signature
-
Sharps or flats required
Altered notes
-
Notes raised or lowered
Relative key
-
Same signature, other mode
Enharmonic equivalent
-
Same pitches, alt. spelling

Ready

Choose a tonic note, accidental, and mode, then press Calculate.

About the Key Signature Calculator

A key signature is the set of sharp or flat symbols placed at the start of a musical staff, telling a performer which notes are consistently raised or lowered for the rest of the piece (or until the next key signature change). This calculator uses the standard line of fifths — the same integer arithmetic used by music notation software — to work out any major or minor key's signature directly from its tonic note.

The formula: line of fifths

Every note letter has a fixed position relative to C on the circle of fifths: F = −1, C = 0, G = 1, D = 2, A = 3, E = 4, B = 5. A sharp on the tonic adds 7 to that position; a flat subtracts 7. For a minor key, subtract 3 more, because the minor tonic sits a minor third below the letter-name major tonic that shares its signature. The result is a single number, the fifths value:

  • Positive fifths value = that many sharps (e.g. +3 = 3 sharps).
  • Negative fifths value = that many flats (e.g. −4 = 4 flats).
  • Zero = no sharps or flats (C major or A minor).

For example, D major: D's base position is 2, no accidental, major mode, so the fifths value is 2 → 2 sharps (F♯ and C♯). B♭ minor: B's base position is 5, minus 7 for the flat, minus 3 for minor, giving 5 − 7 − 3 = −5 → 5 flats (B♭, E♭, A♭, D♭, G♭).

Which specific notes are altered

Sharps are always added in the fixed order F, C, G, D, A, E, B; flats in the exact reverse, B, E, A, D, G, C, F. A key with N sharps always uses the first N letters of the sharp order — never a different combination — so 4 sharps always means F♯, C♯, G♯, and D♯.

Relative major and minor keys

Every major key shares its exact key signature with one minor key, called its relative minor, whose tonic sits a minor third (3 semitones) below the major tonic. G major and E minor both use one sharp (F♯); C major and A minor both use none. The calculator reports this relative key alongside the signature.

Enharmonic equivalents

Practical key signatures range from 7 flats to 7 sharps — 15 keys in total, from C♭ major to C♯ major. Near the middle of that range, keys like C or G major have no simple alternate spelling. Near the edges, two spellings of the same pitches both stay inside the 15-key range: B major (5♯) is the same pitches as C♭ major (7♭), and F♯ major (6♯) is the same as G♭ major (6♭). If you enter a tonic that would require double sharps or double flats to notate (a "theoretical" key, such as G♯ major), the calculator automatically shows its practical enharmonic equivalent instead.

Frequently Asked Questions

How is a key signature calculated from the tonic note?
Every note has a position on the line of fifths: C is 0, each letter sits at a fixed offset (F=−1, C=0, G=1, D=2, A=3, E=4, B=5), a sharp adds 7, and a flat subtracts 7. Minor keys sit 3 positions below their letter-name major equivalent, since the relative minor is a minor third lower. A positive result gives that many sharps; a negative result gives that many flats.
What is the order of sharps and flats?
Sharps are added in the fixed order F, C, G, D, A, E, B (the mnemonic "Father Charles Goes Down And Ends Battle"). Flats are added in the exact reverse order: B, E, A, D, G, C, F. A key with 3 sharps always uses F♯, C♯, and G♯ specifically, never a different combination.
How are a major key and its relative minor related?
A major key and its relative minor share the exact same key signature. The relative minor's tonic sits a minor third (3 semitones) below the major tonic, or equivalently the relative major's tonic sits a minor third above the minor tonic. For example, G major and E minor both use one sharp, F♯.
Why do only some keys have an enharmonic equivalent?
Practical key signatures run from 7 flats to 7 sharps (15 keys total). Two spellings of the same pitch are both practical only when each lands inside that range, which happens at the extremes: B major (5 sharps) equals C♭ major (7 flats), F♯ major (6 sharps) equals G♭ major (6 flats), and C♯ major (7 sharps) equals D♭ major (5 flats). Keys nearer the middle, like G major or E major, have no practical enharmonic twin — the alternate spelling would need double sharps or double flats.