Do goldfish really have a three-second memory?
The short answer
The three-second memory is the most famous thing about goldfish. Here is what decades of experiments say about how much a goldfish can learn and how long it remembers.

Verdict: False. Goldfish remember things for days, weeks and longer. They are one of the classic animals of memory research precisely because they learn reliably and hold on to what they learn, and nothing in that research supports a memory that resets every three seconds.
The three-second figure has no study behind it. Nobody has traced where it first appeared, and it is usually repeated as a joke or a reassurance, often about a fish swimming in circles in a small bowl.
What the evidence says
Scientists test an animal's memory in a simple way: teach it something, wait, and see whether it still knows it. Goldfish pass that test easily.
One of the best-known examples comes from the 1960s. At the University of Michigan, Bernard Agranoff and his colleagues trained goldfish to avoid a mild electric shock by swimming over a barrier when a light came on. The fish learned the task and still performed it when tested days later. Agranoff used goldfish because their memory was dependable enough to measure, and his team's 1964 paper in Science with P. D. Klinger went on to show that blocking protein production in the brain right after training stopped the memory from being stored. That line of work only makes sense in an animal that remembers.

Goldfish are also good at learning colours, which tells us something about how much they can keep in mind at once. The German biologist Christa Neumeyer spent years training goldfish to pick out one colour from others to earn food, and her experiments showed that goldfish have four types of colour-sensing cone in their eyes, including one for ultraviolet light, where humans have three. Experiments like hers need fish that remember which colour paid off from one session to the next.
The wider picture is the same for fish in general. In a 2015 review in the journal Animal Cognition, "Fish intelligence, sentience and ethics", Culum Brown of Macquarie University in Sydney brought together decades of research showing that fish learn routes, recognise individual fish they have met before, and use what they learn to avoid danger. In one of Brown's own experiments, crimson-spotted rainbowfish learned to escape through a hole in a net pulled through their tank and still found the escape route when tested again almost a year later.
None of this means goldfish think like mammals. Their memory is specialised for what matters to a fish: where food appears, what signals danger, how to get around. But in those areas it is measured in days, weeks and months.
What you can see at home
Anyone who keeps goldfish has probably watched them learn without trying to teach them. Fish that are fed at the same spot crowd toward it, and many gather at the front of the tank when the person who feeds them comes near. That is ordinary associative learning, the same kind used in the lab: a cue (a person, a time, a place) followed by food, often enough that the fish starts responding to the cue itself.
It is not proof on its own, because a fish could be reacting to vibration or movement in the moment. That is why the controlled experiments matter. They remove the cue for a while, bring it back, and check whether the fish still responds.
Where the myth came from
Nobody has found an original source, so any account of the myth's origin is a guess. What can be said is why it suits people so well.
It is a kind thought for a pet owner. If a goldfish forgets every lap of its bowl, a small, bare bowl seems harmless, because every lap feels new. That idea may have helped the myth spread, but it rests on the same false premise: goldfish learn their surroundings, and the way they are kept should not depend on a supposed memory gap.
It also fits a common bias about animals that look very different from us. Fish have no facial expressions we can read, they make no sounds we can hear, and they live in a world we rarely see from the inside. It is easy to assume that an animal with a blank-looking face has a blank mind behind it, the same assumption that produced the story of ostriches hiding their heads in the sand. Behaviour studies are a way of asking the animal directly, and the answer keeps coming back the same.
Colour is a good example of how our assumptions about animal senses can go wrong in both directions. Bulls charging at red capes are not reacting to the colour at all, because cattle cannot tell red from green, while goldfish see more kinds of colour than we do. Popular ideas about brains often get it wrong in the same way, as with the claim that people only use 10% of theirs.
The short answer to pass on
A goldfish that remembered nothing beyond three seconds could never learn to come to a feeding spot, avoid a signal it has learned means danger, or pick out a colour it was trained on weeks before. Goldfish do all three, and researchers have been measuring it for more than half a century.