Why does your goldfish keep swimming to the top of tank then poking its head ot water and shaking bottom repeating?

1. Lack of oxygen: Goldfish need a sufficient amount of oxygen to breathe, and when there's not enough oxygen in the water, they may come to the surface to gasp for air. This is especially common in overcrowded tanks or tanks that are not properly filtered or aerated.

2. Water quality issues: Poor water quality, such as high levels of ammonia, nitrites, or chlorine, can irritate a goldfish's gills and cause them to swim to the surface for air. Regular water changes and proper tank maintenance can help prevent these issues.

3. Gill problems: A goldfish may also swim to the surface and shake its head if it has gill problems, such as an infection or parasites. If you notice any damage or abnormalities on the goldfish's gills, it's important to consult a veterinarian for proper treatment.

4. Stress: Goldfish can become stressed due to various factors such as overcrowding, incompatible tank mates, sudden changes in water parameters, or transportation. Stress can lead to changes in behavior, including swimming to the surface of the tank.

5. Boredom: Goldfish can sometimes swim to the surface and shake their heads out of boredom. Providing your goldfish with toys and other forms of enrichment can help prevent boredom and encourage natural behaviours.