According to a 2009 study published in the European Journal of Social Psychology, it takes 18 to 254 days for a person to form a new habit.

The study also concluded that, on average, it takes 66 days for a new behavior to become automatic.

Read on to learn why this is, how this figure varies, what you can do to help maximize your efforts, and more.

The 2009 study highlighted a range of variables in habit forming that make it impossible to establish a one-size-fits-all answer.

For example, certain habits take longer to form. As demonstrated in the study, many participants found it easier to adopt the habit of drinking a glass of water at breakfast than do 50 situps after morning coffee.

What’s more, some people are better suited to forming habits than others. A consistent routine of any kind isn’t for everyone, and that’s OK.

If asked how long it takes to form a habit, many people will respond “21 days.”

This idea can be traced back to “Psycho-Cybernetics,” a book published in 1960 by Dr. Maxwell Maltz.

Maltz didn’t make this claim but rather referenced this number as an observable metric in both himself and his patients at this time.

He wrote: “These, and many other commonly observed phenomena, tend to show that it requires a minimum of about 21 days for an old mental image to dissolve and a new one to gel.”

But as the book became more popular — more than 30 million copies have been sold — this situational observation has become accepted as fact.

According to a 2012 study published in the British Journal of General Practice, habits are “actions that are triggered automatically in response to contextual cues that have been associated with their performance.”

For example, when you get into your car, you automatically put on the seat belt. You don’t think about doing it or why you do it.

Your brain likes habits because they’re efficient. When you automate common actions, you free up mental resources for other tasks.

According to the National Institutes of Health (NIH), pleasure-based habits are particularly difficult to break, because enjoyable behavior prompts your brain to release dopamine.

Dopamine is the reward that strengthens the habit and creates the craving to do it again.

Dr. Nora Volkow, director of the NIH’s National Institute on Drug Abuse, suggests that the first step is to become more aware of your habits so you can develop strategies to change them.

One strategy, Volkow suggests, is to identify the places, people, or activities that are linked in your mind to certain habits, and then change your behavior toward those.

For example, if you have a substance use disorder, you can be deliberate about avoiding situations where you’d be more likely to be around the substance. This can help you achieve your goal of abstaining from using that substance.

Another strategy is to replace a bad habit with a good one. For example, instead of snacking on potato chips, consider swapping for unsalted, unbuttered popcorn. Instead of reaching for a cigarette, consider trying a new flavor of chewing gum or a flavored hard candy.

It can take anywhere from 18 to 254 days for a person to form a new habit and an average of 66 days for a new behavior to become automatic.

There’s no one-size-fits-all figure, which is why this time frame is so broad; some habits are easier to form than others, and some people may find it easier to develop new behaviors.

There’s no right or wrong timeline. The only timeline that matters is the one that works best for you.