Even the most virtuous person has a bad habit (or two) they’d like to break. Whether it’s picking at your skin, grabbing something sweet after every meal, or spending way too much time on Instagram, pick a habit, any habit, and let’s get down to the science of breaking it.

What’s a Habit, Exactly?

A habit is something that a person does often in a regular and repeated way, according to Merriam-Webster, though what constitutes a “bad” versus “good” one is subjective. It’s important to recognize that habits are really a learning mechanism for your mind, says Wendy Wood, Ph.D, a professor of psychology and business at the University of South California who studies habits and behavior. When an action makes us feel good, our brain forms a shorthand connection so when we’re in a similar context or situation in the future, the response that’s been rewarded automatically comes to mind.

Because habits are all about context, the environment leading up to the behavior turns into what psychologists call “cues” or “triggers.” These cues send a signal that says, “Hey, this is the same situation—let’s do the same thing and feel good again.” You have a zit, you pick at it. You finish lunch, you want something sweet. You’re bored in line? You check Instagram.

The problem? Willpower (to not do the bad thing) pales in comparison to the sway these cues hold, Wood says. Ideally, you’d remove yourself from the triggers that set it off. But old habits die hard, so the key is to form a new good habit to keep yourself from repeating the bad one, says Ali Mattu, Ph.D, an instructor of medical psychology at Columbia University’s Clinic for Anxiety and Related Disorders. And if you can’t actually remove yourself from the situation, it can help to create roadblocks to keep yourself from the mindless go-to—turn your phone on airplane mode to avoid scrolling or call a friend instead of reaching for the candy dish on the desk.

Breaking (the) Bad

How do you create a replacement habit? First, keep it simple. The more steps you have to complete before a reward, the harder a habit is to learn. M&MS to mouth: yum, learned. That’s why your replacement habit should be easy and make you feel as good as the original did—otherwise you could backslide, Wood says.

And most importantly, it should be accessible, so you can turn to it whenever the urge for the original pops up, Mattu says (although that’s usually the end of the day, when our willpower is scientifically proven to be weakest).

In other words, if you’re trying to avoid snacking as soon as you get home, don’t make yourself finish a Sudoku—call a friend instead. Unless, that is, Sudoku gives you the same emotional calm as diving into the snack cabinet, the end goal for these replacement habits, Mattu says.

The good news: Forming a new habit can happen in as few as 18 days, Wood says, although the time frame depends on how many steps the behavior is, how good the reward feels, and how much discipline someone has.

Here are three other quick tips for kicking a habit:

1. Change things up.

Altering your environment can be immensely helpful while you’re in the process of creating a new habit, Wood says, even if it’s just moving the chips to the back of the cupboard.

2. Take your time.

Give yourself a realistic time line for cutting back on the bad habit, Mattu says. Go two days without skin picking, give yourself a day off, and try three days next time.

3. Tell a friend.

It may sound corny to share your #goals with friends and family who can amp you up about getting there, but Mattu says the added feelings of congratulations and validation can be a powerful force to keep you on track.

And if you backslide into the bad habit? It happens. Embrace it, look at the situation, figure out what triggered you back into your old ways, and make a note to learn from it in the future, Mattu says. Remember: Rather than beat yourself up when you’re already down, it’s all about moving forward.

The Takeaway

Our brain forms habits for the not-small task of keeping us alive and learning new things, and while it’s tough, breaking a bad one is doable. Context cues play a major role, so forming a new habit is the best method to change your ways—keep it simple and aim to please (yourself), and the bad habit will eventually fade away.