The lifespan of a goldfish can vary depending on its environment and care. On average, a goldfish can live for 5 to 10 years. However, with proper care, some goldfish have been known to live up to 20 years or more. It's important to provide them with a suitable habitat, proper nutrition, and regular maintenance to help ensure a longer and healthier life for your goldfish.