Seymour Benzer, a geneticist who made scientific history by discovering that genes were structured like words and who went on to do pioneering work on the ties between genes and behavior, memory and longevity, died on Nov. 30 in Pasadena, Calif. He was 86.

The cause was a stroke, according to a statement from the California Institute of Technology, where he was a professor emeritus.

Dr. Benzer was born in New York City to immigrants from Poland. On summer vacations in the country as a boy, he had his first experiences in studying biology, catching frogs and dissecting them. For his 13th birthday he received a microscope, “and that opened up the whole world,” Dr. Benzer recalled in a 1990 interview for an oral history project at Caltech.

In 1938, he enrolled at Brooklyn College. Unwilling to bother with introductory biology classes, he ended up majoring in physics. He earned a Ph.D. at Purdue University, where he worked on a secret military project to develop crystals for carrying current in radar systems. He discovered how to make the crystals withstand high voltages, and after World War II engineers at Bell Labs built on the Purdue research to invent the world’s first transistors.

By then Dr. Benzer had returned to biology, becoming fascinated by the mysterious nature of genes.

In the early 1950s, scientists were still debating whether genes were indivisible units or whether they were built up from smaller parts.To answer that question, Dr. Benzer experimented with viruses that infected the gut microbe Escherichia coli. He selected viruses that could not infect a particular strain of E. coli called K because they had defective versions of a gene.

Dr. Benzer knew that when two viruses infect the same host, their genetic material is sometimes blended in their offspring. By repeatedly infecting bacteria, he discovered that the blending allowed some of the resulting viruses to infect the K strain. Dr. Benzer was able to show that the viruses had swapped pieces of the same gene. In some cases, the swaps produced a working version of the gene.

Dr. Benzer established from the experiments that genes are like words, built up from smaller units of DNA. The mutant viruses had misspelled genes, which could be combined into the correct sequence, like combining the first three letters of BENXRQ and the last three letters of PSDZER to produce BENZER.

“He performed one of the most conceptually beautiful experiments of all time,” said Ralph Greenspan, a senior fellow at the Neurosciences Institute in San Diego.

But in the mid-1960s, Dr. Benzer suddenly abandoned his viruses. “When things get to that stage, you wonder why you should be doing something somebody else is already doing,” he explained in the oral history. “It’s just redundant.”

Now Dr. Benzer wanted to understand how genes might give rise to behaviors. His inspiration came from watching his daughters grow up and noticing their widely different personalities.

“If you have one daughter, you don’t notice anything, but if you have a second one, you begin to wonder, ‘Are we doing things differently, or is it genetic?’” he said.

After Dr. Benzer moved to Caltech in 1967, he began to study the behavior of Drosophila flies. He began to study the simplest behavior he could think of: the attraction of flies to light.

Dr. Benzer and his colleagues exposed flies to toxins to trigger mutations. They then sorted through the offspring of the mutant flies to find those that behaved strangely. They found flies that did not respond to the light, others that tried to fly away from it, and many other peculiar variations.

By breeding these mutant flies, Dr. Benzer was able to pinpoint the location of some of the genes responsible for the differences in behavior. Dr. Benzer’s work marked the birth of a new field called neurogenetics. Scientists are now investigating the links between genes and behaviors in other animals, including humans.

With his colleagues, Dr. Benzer went on to discover genes linked to memory in flies and to their internal body clocks.

He won many awards for his research, including the National Medal of Science. But he never won the Nobel Prize, which many of his colleagues believed he deserved.

Dr. Benzer is survived by his wife, Carol Miller; two daughters, Barbara Freidin and Martha Goldberg; a son, Alexander Benzer; two stepsons, Renny and Douglas Feldman; and four grandchildren.

Dr. Benzer continued his research long after the age when most scientists retire. In his late 70s, he began finding genes that control longevity in flies.

“It’s always very refreshing to be able to just make a clean break, start over again with something you’re completely ignorant about,” Dr. Benzer said. “That’s very exhilarating; nothing’s expected of you because you’re a novice; and, with luck, you come up with something that other people were saying was impossible because they know too much.”