Are goldfish freshwater fish?

A fantail goldfish opening its mouth

Goldfish are one of the world’s most popular pets. But do they live in freshwater or saltwater?