All that glitters is not gold is a well-known saying, meaning that not everything that looks precious is precious. The expression, in various forms, dates from at least as far as the 12th century. It might even go back as far as Aesop.
The popular form of the expression is a corruption of a line in William Shakespeare's play, The Merchant of Venice, which uses the 17th century synonym "glisters". The line comes from the secondary plot, the puzzle of Portia's boxes (Act II - Scene VII - Prince of Morocco):
All that glisters is not gold;
Often have you heard that told:
Many a man his life hath sold
But my outside to behold:
Gilded tombs do worms enfold.
Had you been as wise as bold,
Young in limbs, in judgement old
Your answer had not been inscroll'd
Fare you well, your suit is cold.
Panning for gold often results in finding pyrite, nicknamed fool's gold, which reflects substantially more light than authentic gold does. Gold in its raw form appears dull and does not glitter.
"Not all that glitters is gold" is an alternate formulation.
An opposite version of this line ("All that glitters is gold") appears as a lyric in the Led Zeppelin song "Stairway to Heaven", as well as the Smash Mouth song "All Star" and the Death in Vegas song "All That Glitters".