It's really easy.
Multiply your gravity by your volume to get gravity units.
Gravity Points x Volume = Gravity Units
So say you had 5 gallons of 1.050. 50 x 5 = 250 gravity units
Divide your actual number into the 100% efficiency number. Let's say it's 312.
250/312 = 80% efficiency.
As for the 312...that's determined by your recipe. A good approximation is (Grain weight) x 37. Each grain has a theoretical 100% effieciency extraction, often listed as Points per Pound per Gallon, or PPG. Most base malt is ~37 (meaning 1 pound in 1 gallon gives you 1.037).
Important note: There are a variety of efficiency measures:
- Mash efficiency: How much starch is converted to soluable sugar
- Lauter efficiency: How much of the sugar is extracted versus left stuck in the grain bed
- Brewhouse efficiency: How much of the sugar made it into your fermenter