Knitting gauge: stitches, rows and yarn
The swatch is the only thing that decides whether the sweater will fit. Here it becomes the number of stitches to cast on, the rows to work and, if you weigh it, the balls of yarn to buy.
Knit a swatch with the stitch and the needles of the project, wash it and lay it out the way you will treat the garment, then count in the middle. Out come the stitches to cast on and the rows to work.
How to measure a swatch that does not lie
Knit a square of at least 15 by 15 cm with the same yarn, the same needles and the same stitch as the project, then wash it and lay it out exactly as you will treat the finished garment. Washing changes the gauge, sometimes by 10 per cent, so a dry swatch and a washed garment are not the same thing. Count in the middle, over at least 10 cm, never near the curling edges, and keep the half stitches: if you see 21 and a half, write 21.5, not 22.
The formula, in two lines
Divide the stitches you counted by the width you counted them over and you get stitches per centimetre. Multiply by the width you want and you have the cast-on; same with rows for the height. The unit cancels out on its own, so the calculation works the same in centimetres or inches, as long as the swatch and the target size use the same one.
Why stitches are rounded to the pattern repeat
2x2 rib needs a number divisible by 4, and worked flat two more stitches to close symmetrically; a cable panel has its own repeat, usually printed as a multiple of N plus M. Rounding to the wrong number breaks the design halfway right at the edge, where it shows. This tool looks for the nearest valid number to the size you asked for and tells you how far off you land, so you decide whether to go under or over. Selvedge stitches stay outside the repeat but inside the width.
Yarn is bought by length, not by weight
The weighed swatch gives grams per square centimetre, and from there the grams for the whole project; the length is those grams times the length of one ball divided by its weight. When you substitute yarn, length is what counts, not weight: two 50 g balls, one with 125 m and one with 90 m, make two different garments, and with the second one you run out mid sleeve. Buy all the balls together and check the dye lot printed on the label.
The limits, said plainly
This is an estimate, not a guarantee. Hand tension changes with tiredness and between circular and straight needles, ribbing pulls in and has to be measured relaxed, yarn grows or felts after washing. And the yarn figure depends on your scale: on a 5 g swatch one gram of error is 20 per cent of the total, which on a sweater is a couple of balls, so the tool always shows you what that error is worth instead of hiding it.