By knitting a gauge swatch you'll make sure that the measurements of your finished product match those of the pattern.

Gauge

Knitting patterns are always based on a gauge, which is mentioned in the beginning of the pattern. Patterns usually include a suggested needle size to achieve this gauge; however, to avoid unpleasant surprises, you should always check your gauge before starting a new project. This is because different people knit differently: some produce a very tight knit, others a very loose one. Therefore, their gauge differs as well. Even when using the same yarn and the same needle size, the finished product may be very different in size!

Swatch

Knitting a gauge swatch will allow you to check your gauge. To produce an accurate gauge swatch, always use the exact yarn, needles and stitch you're planning on using for the actual project. Make your swatch big enough to comfortably measure stitches from a 10cm x 10cm area. Bind the swatch off and lightly steam. 

Measure your gauge from the swatch by counting the stitches from a 10cm x 10cm area. Count both the number of stitches and the number of rows, because stitches are not exactly square. When counting stitches from a swatch with ribbing (or brioche knitting, for example), slightly stretch the swatch—this way, the finished product doesn't come out too large. 

Checking your gauge 

Compare your gauge to the one mentioned in the pattern. If they match, great! You can start working on your project right away. 

If the gauge does not match, no panic! You can easily fix the situation by changing your needle size. If your swatch has fewer stitches per 10cm than the pattern gauge, switch to smaller needles and stitch count will increase. If your swatch has more stitches per 10cm, switch to bigger needles and your stitch count will decrease. Knit a new swatch with the new needles and check the gauge before starting your project.