There is no universal number of fish for a 20 gallon tank. A lightly built school of tiny fish may fit in larger numbers than a group of stockier or more active fish, while territorial species may need most of the tank for only one pair. The RSPCA notes that simple fish-length guidelines are only rough guides because filtration, temperature, water quality and husbandry all affect capacity.
Questions about 'how many fish' sound numerical, but stocking is biological and behavioural. The same 20 gallons can be comfortably stocked or badly overcrowded with the same number of fish depending on what those fish are.

Adult size comes first
Use the fish's mature length and body mass, not juvenile shop size. A few deep-bodied adults can create more waste and need more room than many tiny species.
Social group size matters
If a species needs a group of six or more, the tank must accommodate the entire group. Do not reduce the group to make an unsuitable species fit.
Tank shape changes capacity
A 20 long offers more swimming and bottom area than a 20 high, so the same fish list may not suit both equally.
Leave a margin
Do not aim for the calculator's absolute ceiling. Headroom makes feeding errors, growth and missed maintenance less dangerous.
Frequently asked questions
Is 20 fish in a 20 gallon tank okay?
Not necessarily. The species and adult size matter far more than matching fish count to gallons.
Does a bigger filter mean I can add more fish?
Only partly. It may process more waste, but it does not create extra territory or swimming space.
Should I use the one-inch-per-gallon rule?
Only as a crude historical reference, not as a stocking decision rule.
Sources and further reading
This guide separates general aquarium arithmetic from fish-welfare decisions. For species-specific limits, always check the needs of the fish you intend to keep.