A piano keyboard octave, numbered by the order sharps / flats are added to a key signature. Turn on "Trick Order" to watch C# and D# slide inward, into the trio of black keys โ so all the numbers line up in sequence.
Keys with sharps: Find the last sharp in the key signature. A semitone above it is the major key; a whole tone below it is the relative minor key.
Each move to a new major key on the sharp side adds one sharp. The newly sharpened note is scale degree seven of the new key โ the leading tone that points to its tonic.
Keys with flats: Start with F major, which has one flat: Bโญ. The flat you see points to the name of the next major key: after F major comes Bโญ major. Its newly added flat is Eโญ, so Eโญ major comes next.
This gives the rule: with two or more flats, the second-to-last flat names the current major key. To find its relative minor, move down a minor third (three semitones) from that major tonic.
How do you move around the circle of fifths? Start at C major, with no sharps or flats.
Toward the sharps: C โ G โ D โ A. Each step goes up a perfect fifth and adds one sharp.
Toward the flats: C โ F โ Bโญ โ Eโญ. Each step goes up a perfect fourth and adds one flat.
For example, from C to F you can go up a fourth or down a fifth to a lower F. That is why perfect fourths and fifths are inversions of each other.