The morning British pharmacist Stewart Adams was scheduled to address a pharmacology conference in Moscow in 1971, he was still feeling a bit hung over. His Soviet hosts had toasted him with multiple shots of vodka at a reception the night before. He was more used to warm English ale. So that morning he took 600 mg of a new drug he had co-patented called Brufen, a pain-reliever he had created for rheumatoid arthritis sufferers. It eased his headache.

The drug became known as the painkiller ibuprofen, later branded as Nurofen, Advil and Motrin, and now is one of the world’s most popular painkillers with billions of dollars in annual sales. On average, it is estimated that one packet of the painkiller is bought in the United States every three seconds.

“It’s funny now,” Dr. Adams told Britain’s Telegraph newspaper in 2007. “But over the years so many people have told me that ibuprofen really works for them and did I know it was so good for hangovers? Of course, I had to admit I did.” Referring to that Moscow morning, he went on: “That was testing the drug in anger, if you like. But I hoped it really could work magic.”

Dr. Adams, who developed the drug for Boots the Chemists, Britain’s biggest chain of pharmacists, and worked for them his entire 54-year career, never made a penny from the drug he developed and co-patented with organic chemist John Nicholson in 1962.

In fact, he used to joke that, apart from ibuprofen users, he was probably the only person to have lost money from the drug because Boots never paid him the promised 1-pound patent fee. He lived in a modest home outside the English city of Nottingham until his death on Jan. 30, at age 95, and whenever he got a headache, he went to the nearest Boots or corner shop and paid for his ibuprofen like a regular customer.

His son Chris Adams confirmed the death, at a Nottingham hospital, but did not provide a cause.

Boots, a household name in Britain for 170 years that has more than 2,400 stores, is part of the American holding company Walgreens Boots Alliance, which last year reported sales of $131.5 billion.

Stewart Sanders Adams was born April 16, 1923, in Byfield, near Northampton in the East Midlands. He grew up in a rural farming area until his family moved to Doncaster, in Yorkshire, when he was 10. His father was a train driver for British Railways.

Leaving school at 16, he started a three-year apprenticeship as a pharmacist at Boots. The company paid for him to receive a bachelor’s degree at University College Nottingham (now the University of Nottingham). He later received a doctorate in pharmacology from the University of Leeds.

When war broke out in 1939, he was poised to fulfill his compulsory national military service. But Boots insisted his training in pharmacology would be better served in helping the wounded who returned home. After the Boots research department at University College Nottingham was bombed by the Luftwaffe in May 1941 — killing 45 people in the college alone and over 150 more in the city — Dr. Adams’s research team moved to a small house outside the city, where their kitchen became their lab. It was there that he and Nicholson began the research that would ultimately result in ibuprofen.

First, though, his priority was producing penicillin, vital in treating the wounded. He recalled cultivating millions of doses of penicillin — at the time considered a new “wonder drug” — which he put in quart milk bottles for hospitals around Britain.

When he and Nicholson began trying to create a new nonsteroidal anti-inflammatory drug for rheumatoid arthritis sufferers, they went through years of trial and error. Four compounds failed clinical trials because of negative side effects. They patented their fifth compound, Brufen, in 1962. It passed clinical trials at the Northern General Hospital in Edinburgh, Scotland, in 1966, and three years later was available in Britain as a prescription treatment for rheumatic diseases.

After Dr. Adams’s Moscow hangover test, Boots marketed the drug as a general painkiller. It became an over-the-counter medication in Britain in 1983 and in the United States one year later. “Getting the drug approved by the two countries with the toughest regulatory authorities — the U.K. and the U.S. — was a goal I wanted to achieve,” Dr. Adams told the Telegraph. “For me, that was the most exciting time of all.”

Dr. Adams formally retired from Boots in 1983 but stayed on as a consultant for 10 more years. Queen Elizabeth II made him an Officer of the British Empire in 1987 for his services to science.

In 1950 he married Mary Harvey, a fellow Boots scientist who later worked as a geography teacher. She died in 2010. Survivors include two sons, Chris Adams, a lawyer, and David Adams, dean of the medical school at the University of Birmingham.

While proud of his achievements, Dr. Adams was one of the first to warn that painkillers should be used in moderation and that, used in excess, they could become counterproductive, causing the very headaches they were created to relieve.