Fermentation to produce alcohol is a vastly complex thing. However, simplified to an almost criminal level, yeast consumes sugar producing ethanol. But, how do brewers know how much alcohol is in their beer?

 Arguably, a brewer doesn't really "make" beer, rather a brewer makes sugar for the yeast to consume. This sugary solution, before it's fermented into beer, is called wort (pronounced like the word "word"). At the end of a brew day, the brewer will measure their success in a number of ways. The main way is by measuring how much sugar has been extracted from the barley and other malts. This is done using a tool called a hydrometer, which looks like a large fishing float with a ruler on the stem (see below). This piece of invaluable equipment is calibrated so that when it floats in water, the point where the water intersects the stem is at 1.000. This is the density of water according to "specific gravity" (except it isn't really, distilled water is 0.998 but shhhhh). So, as this number goes higher, it indicates the presence of something denser than water. In the case of brewing, it is sugar

 

 

 

A typical beer might be measured at 1.040. This means that if you took a cubic meter of this liquid, it would weigh 40kg more than a cubic meter of water. As the yeast consumes this sugar, it produces alcohol at a predictable and proportionate rate. A typical beer might finish fermenting  at 1.008. So, in our cubic meter of hypothetical wort, the yeast has eaten 32kg of sugar.

Here comes some simple maths:

Alcohol % = (starting gravity - final gravity) x 130
Or in our example
Alcohol % = (1.040 - 1.008) x 130 = 4.16%
And that's it! There are many nuances that have been glossed over here, and a few other methods of measuring alcohol in beer, but this is the way that the majority of small batch beer will have its alcohol measured.