One fancy goldfish, and why one is the whole answer
A 20-gallon tank matches the most-used guide in goldfish keeping: about twenty gallons for the first fancy goldfish, with ten more needed for every fish after that. Fancy varieties — fantails, orandas, ryukins, ranchus, black moors — grow to roughly six to eight inches with deep, rounded bodies, and a single one can live its whole life in twenty gallons if the maintenance is honest. What it cannot do is share. A second fancy pushes the waste load and oxygen demand past what twenty gallons can dilute between water changes, and both fish pay for it in water quality long before the tank ever looks crowded to you.
The maintenance that makes twenty gallons work
Goldfish are messy in a way most tropical fish are not: they dig, they eat heavily, and they produce waste in proportion to their appetites. Run a filter rated for a tank larger than yours and keep its media rinsed in removed tank water rather than under the tap. Change a generous portion of the water every week — more often if tests show nitrate climbing — and siphon the substrate, because goldfish root through it all day and stir debris into the water column. Feed a quality sinking pellet once or twice a day in amounts eaten within a couple of minutes, with peas or other vegetable matter and an occasional protein food for variety. Most 20-gallon goldfish problems trace back to feeding and water changes slipping, not to the tank itself.
Why commons and comets are still excluded
It is tempting to put a slim common goldfish in a 20-gallon because it starts out looking like it fits. Single-tailed goldfish are pond athletes: they grow past a foot long, they are built for long, straight swimming, and in twenty gallons one will stunt and foul the water while still looking deceptively slender. If a common or comet is the fish you actually want, the honest minimum is a much larger tank or a pond — and if you already have one in a 20-gallon, plan its move while it is still young, before growth makes the transfer urgent.
What else can live in the tank
Very little, and that is fine. Goldfish are cool-water fish that eat anything small enough to fit in their mouths, which rules out the small tropical community fish most 20-gallon owners consider first. A few large snails, such as nerite or mystery snails, are the usual safe addition and earn their keep on algae and leftover food. Plants are a gamble, since goldfish uproot and nibble them, though sturdy or floating plants sometimes survive the attention. Think of the tank as a single-pet home, the same way you would think of a betta's tank, just at goldfish scale.
Planning the setup before the fish comes home
A lone fancy goldfish is a personable, long-lived pet, and twenty gallons done properly is a good home for one. Weighing this setup deserves care before any fish depends on it; put a follow-up question to KinsLe's Kimmy; she answers using the KinsLe Answers library.