How long does it take to form a habit? ‘There’s no magic number,’ study shows

PASADENA, Calif. — We all know an old habit can be hard to shake, but just how long does it take to form a new habit? There’s no singular answer to that question, according to researchers at the California Institute of Technology. Put another way, context is key when it comes to forming habits. After all, not all habits are equally important, or challenging.

Study authors found it usually takes an average of about six months to get comfortable with habitually heading to the gym. However, they also report it takes an average of just a few weeks for healthcare workers to get in the habit of washing their hands.

“There is no magic number for habit formation,” says Anastasia Buyalskaya (PhD ’21), now an assistant professor of marketing at HEC Paris, in a university release.

The research team also included Caltech’s Colin Camerer, Robert Kirby Professor of Behavioral Economics and director and leadership chair of the T&C Chen Center for Social and Decision Neuroscience, and researchers from the University of Chicago and the University of Pennsylvania. Xiaomin Li (MS ’17, PhD ’21), formerly a graduate student and postdoctoral scholar at Caltech, is a co-author as well.

“You may have heard that it takes about 21 days to form a habit, but that estimate was not based on any science,” Prof. Camerer explains. “Our works supports the idea that the speed of habit formation differs according to the behavior in question and a variety of other factors.”

This project was the first ever to make use of machine learning tools to study habit formation. The research team used machine learning to analyze large data sets encompassing tens of thousands of people who were either swiping a badge to enter their gym or washing their hands during hospital shifts.

Man washing his hands
(© maridav –

During the gym portion of the study, researchers partnered with 24 Hour Fitness. Meanwhile, for the hand-washing research, they partnered with a company that uses radio frequency identification (RFID) technology to monitor hand-washing across hospital settings. In total, the datasets tracked over 30,000 gym-goers over the course of a four-year period and more than 3,000 hospital workers over close to 100 shifts.

“With machine learning, we can observe hundreds of context variables that may be predictive of behavioral execution,” Prof. Buyalskaya comments. “You don’t necessarily have to start with a hypothesis about a specific variable, as the machine learning does the work for us to find the relevant ones.”

The use of machine learning also allowed study authors to analyze people over time in their natural environments. Most earlier studies, in comparison, had participants filling out questionnaires, which limited their accuracy.

Researchers report certain variables had no effect on gym habit formation, for example, the time of day. Other factors, however, such as one’s past behavior, did come into play. For instance, among 76 percent of gym-goers, the amount of time that had passed since a previous gym visit was a key predicator of whether that person would return.

In other words, the longer it had been since a gym-goer’s last work out, the less likely they were to make a habit of exercise. Notably, 69 percent of gym-goers were more likely to go to the gym on the same days of the week. Monday and Tuesday were the most well attended days of the week.

During the hand-washing portion of the project, researchers searched specifically for data from health care workers who had been given new requirements to wear RFID badges that tracked their hand-washing activity.

“It is possible that some health workers already had the habit prior to us observing them, however we treat the introduction of the RFID technology as a ‘shock’ and assume that they may need to rebuild their habit from the moment they use the technology,” Prof. Buyalskaya adds.

“Overall, we are seeing that machine learning is a powerful tool to study human habits outside the lab,” she concludes.

The study is published in Proceedings of the National Academy of Sciences.

Leave a Comment