Count five letters
C, D, E, F, G make five letter names. C–G♭, C–G and C–G♯ are all fifths by spelling.
Six, seven or eight semitones
C–G is a perfect fifth (P5) at seven semitones. One key lower, C–G♭ is a diminished fifth (d5) at six. One key higher, C–G♯ is an augmented fifth (A5) at eight. C–G♭ shares a key with the augmented fourth C–F♯.
Practice the relationship
Find the seven-step perfect fifth first, then use its neighboring keys to identify diminished and augmented fifths.