Here is a YouTube video I put up recently describing the difference between sharps and flats:

It requires a little prerequisite theory knowledge, though I hope it's accessible. Here is the video transcript:

"What is the difference between F sharp and G flat?" It's a question asked often enough, but what comes along less often is a satisfactory answer. It is my hope that by the end of this video you will have not only an understanding of WHY there's a difference, but an understanding of how to use that difference to make, play, and talk about music more effectively.

Let's start with a staple of music theory: the spiral of fifths. It shows that, starting from the naturals and using a chain of fifths, you can arrive at every note we could ever use in western music: The sharps, the flats, the double sharps, the double flats, and so on. Also, notice that we can derive any diatonic scale from a continuous, unbroken chain of seven fifths.

For one example, the G major diatonic scale can be generated from a chain of fifths from C to F#, which rearranges to G-A-B-C-D-E-F#.

Neither of those facts is coincidence. In fact it is by this chain of fifths that we DEFINE the notes that EXIST in western music, and it is by any 7 notes connected by an unbroken chain of fifths that we DEFINE our diatonic scales.

So most simply, the difference between F# and Gb is each's different location in the spiral of fifths, and therefor the scales to which they do and do not belong. If you're using the G major scale, the right note is F#, and if you're using the Db major scale, Gb is the correct note. But let's delve a little further and ask "So what?" If they're the same pitch, why define things that way?

First, know that intervals are measured in a unit called "cents" where there are 1200 in every octave, 100 cents per half step, and therefore 700 cents per fifth, at least in standard western tuning.

Let's prove that F# equals Gb specifically because the fifth is 700 cents.
From F# to Gb in fifths is F#-B-E-A-D-G-C-F-Bb-Eb-Ab-Db-Gb, or 12 fifths.
Starting with Gb at 0 cents, and adding
12 fifths * 700 cents/fifth gives you 8400 cents.
Dropping that note into the original octave by subtracting 6 octaves, 8400 cents - 1200 cents per octave times 6 octaves gives you 8400 cents minus 8400 cents, which comes out to 0 cents. Because 0 cents is a unison, F# is equal to Gb.

The G major scale and I IV V I progression using these pitches sound like this:
And the same pattern but replacing Gb for F# sounds exactly the same.

The size of the fifth can change however, and when it is not exactly 700 cents then F# and Gb actually have DIFFERENT PITCHES. Motivations for adjusting the size of the fifth in the first place include better harmonic purity ("more in-tune") or melodic clarity (with a starker contrast between major and minor). Still, the over all musical structures stay pretty much the same.

If we flat the fifth a nearly imperceptible 5 cents to 695 cents:
From F# to Gb in fifths is still F#-B-E-A-D-G-C-F-Bb-Eb-Ab-Db-Gb, or 12 of these slightly flatter fifths.
12 fifths * 695 cents/fifth = 8340 cents
Dropping that note down 6 octaves gives 8340 cents - 8400 cents = -60 cents. That means that, with a fifth of 695 cents, F# differs from Gb by 60 cents!

The G major scale and I IV V I progression using these new pitches sound like this:
Different nuances from before, but recognizably the "same thing".
The same pattern but replacing Gb for F# sounds like this:

It's completely different, and quite wrong for that "major scale" sound we all know and love.

Why would it turn out that F# sounds so much better in this context than Gb? Well, the decision to define our scales by unbroken chains of fifths is not arbitrary. Scales created by continuous unbroken chains of one given interval have perceptually relevant properties in music, where intervals sizes are regular (with only two sizes per interval class, aka major and minor), and where the different step sizes are distributed evenly throughout the scale. (For example, the diatonic scale has the minor seconds as far apart as possible between the major seconds.) Such scales are called "Moment of Symmetry" (or MOS) scales. Replacing a note like F# with another note like Gb, though they may be close in pitch, disrupts this regularity, and voids the definition of MOS.

You imply this difference between the sharps and flats even when using standard western tuning with a fifth of 700 cents, where F# and Gb are the same pitch. *This*, ladies and gentlemen, is the difference between the sharps and the flats. They differ in their location in the spiral of fifths, which describes their difference in function, which is audible in tunings where the fifth is not 700 cents.

Curious about playing and composing music in different tunings? Check out some of these links!