How long does it actually take to form a lasting habit?

If your friend successfully cultivated an exercise routine within a couple of weeks and you’re still struggling to develop a consistent schedule for doing your laundry, there’s no need to feel like a failure — according to a new study, there’s no one timeline for forming a habit, and it varies widely depending on the task at hand.

Scientists at the California Institute of Technology studied two specific activities that can be habit forming in order to get a better idea of the mechanisms of training oneself to fall into that pattern.

They found that to form a gym habit took an average of about six months.

But on the other hand, it took health-care workers an average of just a few weeks to get in the habit of washing their hands as frequently as the job requires.

“You may have heard that it takes about 21 days to form a habit, but that estimate was not based on any science,” Colin Camerer, a professor of behavioural economics at Caltech and one of the study authors, said in a news release. “Our works supports the idea that the speed of habit formation differs according to the behaviour in question and a variety of other factors.”

“There is no magic number for habit formation,” Anastasia Buyalskaya, one of the study authors and now an assistant professor of marketing at HEC Paris, added in the release.

To gather data on the two specific habits they wanted to juxtapose, researchers partnered with 24 Hour Fitness to analyze data on how often people were swiping their badges to enter the gym, and partnered with a separate company to monitor hand-washing in hospitals.

Put together, the data encompassed the patterns of more than 30,000 gym goers over a period of four years, and more than 3,000 hospital workers across nearly 100 shifts.

The study, published Monday in the peer-peer-reviewed journal Proceedings of the National Academy of Sciences, used machine learning to be able to juggle this massive amount of data.

“With machine learning, we can observe hundreds of context variables that may be predictive of behavioural execution,” Buyalskaya said. “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.” 

Forming a habit describes the phenomenon in which doing the same thing repeatedly eventually makes it part of a person’s regular schedule, taking up significantly less mental space and energy than it did when they first started integrating this new activity or action. But the science behind what makes it easier and how we go about forming a habit is hard to pin down because the idea encompasses so many extremely different activities or actions.

When looking at the formation of a gym habit, researchers found that across the body of data, the time of day that people were going to the gym had no impact on whether or not they were able to form a habit. But past behaviour did play into it. For 76 per cent of those included in the dataset, the amount of time that had passed since they last attended the gym was heavily connected to whether they were likely to make a gym habit or not.

Those who had stayed away for a longer stretch were much less likely to be able to ultimately form a gym habit.

Just under 70 per cent of the gym goers went to the gym on the same day of the week, with Monday and Tuesday being the most common.

Researchers noted that when it came to the hand-washing data, they had no way of knowing how diligent the individual health-care workers had been at hand washing in their personal lives prior to taking part in the study. The study involved them being given new badges with radio-frequency identification (RFID) technology to monitor their hand washing, potentially kick-starting habit formation.

“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,” Buyalskaya said.

The study only looked at two specific activities, but researchers are hoping to use machine learning to study more about habit formation in the future.