How a Punnett square works
A Punnett square lists the gametes each parent can make and pairs every one from the first parent with every one from the second. Each gamete carries one allele per gene, so a parent heterozygous at one locus (Aa) makes A and a gametes, and a double heterozygote (AaBb) makes AB, Ab, aB and ab. The square is the product of those lists, which is why one gene gives four cells and two genes give sixteen.
Each cell is an offspring genotype. Counting identical cells gives the genotype ratio, and grouping genotypes that look the same under complete dominance gives the phenotype ratio. The familiar 3:1 from Aa × Aa and 9:3:3:1 from AaBb × AaBb both fall out of that count, not from a memorised formula.
Reading the letters
Upper case marks the dominant allele and lower case the recessive one; Aa and aA are the same genotype, which is why the tool normalises them. A dominant phenotype appears whenever at least one dominant allele is present, while a recessive phenotype requires two recessive alleles. With two genes, the phenotype is written one letter per locus, for example AB for dominant at both, Ab for dominant at the first and recessive at the second.
This simple model assumes one letter per locus and complete dominance. Incomplete dominance, codominance, multiple alleles and lethal genotypes each need their own representation, and none of them is modelled here.
What the ratios do and do not predict
The ratio is the expected proportion over many offspring, not a guarantee for a single litter or a small plate of seedlings. With four expected classes at 9:3:3:1, a sample of twenty individuals can easily look nothing like the ratio by chance; a chi-square test against the expectation is the honest way to ask whether the data fit.
The square also assumes independent assortment between loci and no linkage, selection, mutation or genotyping error. Two genes on the same chromosome, or a cross involving a lethal combination, will not follow the textbook ratio. Treat the output as the null expectation for a controlled cross, not as a prediction of any particular family.