Assign the letters A to G in order from the root, then work out what accidental each one needs. The pitch decides the sound; the letter decides the name.
It is what makes a key readable on a stave: each line and space is used once and the accidentals carry the rest. Calling the seventh note of F♯ major “F” instead of “E♯” would use the letter F twice and the letter E not at all, which on paper produces two notes on the same line and an empty space beside them. Follow the rule far enough and it genuinely requires double sharps.
Scales with five, six or eight notes cannot obey it — there are not seven letters to go round — so a pentatonic or a diminished scale has no single correct spelling and is written by whichever names read most easily in context.
Estimate with the rule, then check it against the calculator that models it properly.
Open Scales, Modes & Fretboard →Assign the letters A to G in order from the root, then work out what accidental each one needs. The pitch decides the sound; the letter decides the name. It is what makes a key readable on a stave: each line and space is used once and the accidentals carry the rest.