Goldfish are omnivorous and opportunistic feeders and will consume virtually anything that their small mouths allow. This can include insects, worms, small plants, algae, and even small fish and fish eggs. Unfortunately, this also includes their own offspring. While cannibalism is a natural behavior for many species of fish, and can be seen as a part of nature's process of natural selection, it is rarely seen in goldfish kept as pets. In a controlled aquarium environment, the occurrence of cannibalism in goldfish is often a sign of overfeeding or overcrowding, as the fish become stressed and compete for resources.
To discourage cannibalism in goldfish, it is recommended to provide a well-balanced diet, limit the number of goldfish in the aquarium, and provide hiding spots and plants for them to retreat to. Additionally, it is recommended to separate the adult fish from the younger fish, as the adults are more likely to eat the younger fish.