The Science of Habit Formation: What I Learned Building a Habit App
How habits form in the brain, what dopamine really does, why a habit takes about 66 days, and what the research changed in the app I build.

On this page
- Why willpower isn't enough
- How habits work in the brain
- Dopamine and habits: what it actually does
- How long does it really take to form a habit?
- Start with a problem, not a habit
- How to build a habit: a 4-step system
- How to break a bad habit
- What I built into Habigrow because of this research
- Your first week: a 7-day starter plan
- Small habits, compounded
I started building Habigrow to fix my own problem with motivation and discipline. Like most people, I thought the answer was more willpower: try harder, feel more motivated, push through.
Then I started reading the research on how habits actually form, from how dopamine and rewards work to how cues trigger actions without a decision. It changed how I saw the whole problem. Habits aren't a willpower problem. They're a design problem: what you see, when you see it, and how hard the first step feels.
This post is that research in plain words, what it means for building your own habits, and what I changed in the app because of it.
Why willpower isn't enough
Willpower is lowest exactly when you need it: late at night, after a long day, when you're stressed. Plans that rely on it break the first time life gets busy.
A habit is different. Once a behaviour is automatic, it no longer needs a decision. That's the real win:
- No more arguing with yourself. You stop debating whether to go for a walk; you just go.
- Hard things get easier. What takes effort in week one takes almost none by month two.
- Small wins compound. Five pages a day is several books a year.
- It works on bad days. A habit doesn't care whether you feel motivated.
How habits work in the brain
Deliberate decisions are handled by the prefrontal cortex, the part of the brain that plans and weighs options. It's powerful but tires quickly. With repetition, behaviours that happen in the same context shift towards the basal ganglia, deeper brain structures involved in learned routines. That shift is why you can drive a familiar route while thinking about something else.
Psychologists Wendy Wood and Dennis RΓΌnger describe habits as actions triggered automatically by context: a place, a time of day, or the thing you just did. You don't decide to do a habit. The situation starts it for you.
Every habit runs on the same loop:
- Cue: something that triggers the behaviour, like a time, a place, a feeling or the action before it.
- Routine: the behaviour itself.
- Reward: the payoff that tells your brain this is worth repeating.
Dopamine and habits: what it actually does
When I started reading about this, I assumed dopamine was the "pleasure chemical". The research is more interesting than that.
In a classic 1997 paper, Wolfram Schultz, Peter Dayan and Read Montague showed that dopamine neurons fire strongly when a reward is unexpected. As an animal learns which signal comes before the reward, the response moves earlier, to the cue itself. In other words, the brain learns to get excited about the signal that predicts the reward, not just the reward.
That explained a lot about my own bad habit. The pull to open Instagram started before I'd seen a single reel: the app icon, a free moment after office, the phone in my hand. And because you never know if the next reel will be good, the feed keeps you checking. I wrote about how I broke that loop in how I stopped scrolling in bed.
The lesson works the other way too. To build a good habit, make the cue obvious and make the reward come quickly, so your brain starts linking the two.
How long does it really take to form a habit?
You've probably heard 21 days. That number doesn't come from research. A study by Phillippa Lally and colleagues at UCL, published in 2010, followed people building a new daily habit, like drinking water with lunch or going for a run before dinner. On average it took 66 days for the behaviour to feel automatic, with a huge range: 18 to 254 days.
The same study found something more useful: missing a single day didn't meaningfully set people back. What mattered was coming back.
This one changed how I built streaks in Habigrow. A streak that resets to zero after one missed day punishes exactly the moment that doesn't matter. So the daily streak counts any day you finish at least half your habits, each habit keeps its own streak, and you can restore a missed day.
Start with a problem, not a habit
"Drink more water" and "meditate daily" often fail for the same reason: they're solutions to a problem you haven't named. You won't keep doing something when you can't remember why you started.
Flip it around. Start with what's actually hard right now, then pick the smallest habit that works on it. "I scroll in bed and sleep late" leads to a phone-down time. "I can't start work" leads to five minutes on your hardest task. That's why Habigrow starts from your problem, not from a list of habits.
How to build a habit: a 4-step system
Step 1: Make it about who you're becoming
Outcome goals tell you where you want to end up. Identity tells you how to act today. Every time you do the habit, you cast a small vote for the person you want to be: someone who reads, someone who moves, someone who finishes what they start.
Step 2: Make it tiny
The hardest part of any habit is starting, so shrink the start until it's almost silly. Read one page, not thirty. Do 10 push-ups. Open the document and write one sentence. You can always do more. The point is to never skip.
Step 3: Attach it to something you already do
Use a habit you already have as the cue for the new one: "After I [current habit], I will [new habit]."
- After I pour my morning coffee, I'll write down today's top task.
- After I take off my work shoes, I'll put on my gym clothes.
- After I plug in my phone at night, I'll leave it outside the bedroom.
Plans like these, which spell out when and where you'll act, are called implementation intentions. A review of 94 studies found they make people noticeably more likely to follow through than a goal alone.
Step 4: Design your environment
Change what you see and you'll change what you do.
- Drink more water: keep a filled bottle on your desk.
- Read more: leave a book on your pillow every morning.
- Scroll less at night: charge your phone outside the bedroom.
- Eat better: fruit on the counter, snacks on the top shelf.
How to break a bad habit
You don't delete a bad habit. You interrupt its loop.
Make the cue invisible. If you can't see the trigger, the craving rarely starts. Leave your phone in another room while you work. Move the app that eats your evenings off your Home Screen.
Keep the cue, swap the routine. Sometimes you can't avoid the cue. I can't stop coming home from the office. What I could change was what I do first: instead of opening reels, I open my laptop and work on my apps for 10 minutes. Same cue, new routine, and a reward I actually feel good about the next morning.
What I built into Habigrow because of this research
Every main feature in the app comes from one of these findings.
| What the research says | What it means for you | In Habigrow |
|---|---|---|
| Habits are triggered by cues | Make the cue obvious | Reminders and Home Screen widgets |
| Fast rewards strengthen the habit | See progress right away | Tick a habit, watch the streak and heatmap grow |
| It takes around 66 days, and one miss is fine | Don't restart from zero | Daily streak counts half your habits; restore a missed day |
| Starting is the hardest part | Shrink the first step | Every problem comes with a starter habit under 5 minutes |
| Different habits need different goals | Match the goal to the habit | Yes/no, count, checklist and timer habits |
| Habits are a long game | Keep your history for years | Data stays on your phone; Google Drive backup with Premium |
The widgets are my favourite example. I noticed I sometimes ignore reminders, but I unlock my phone dozens of times a day. Putting the streak on the Home Screen turned every unlock into a cue.
Your first week: a 7-day starter plan
Reading about habits is easy. Here's what to do this week, one small step a day.
| Day | What to do |
|---|---|
| 1 | Name the problem in one sentence, like "I can't start work" or "I scroll in bed" |
| 2 | Pick one tiny habit that takes under five minutes and works on that problem. Do it once today |
| 3 | Choose the cue: finish "After I ___, I will ___" and set a reminder for that time |
| 4 | Remove one obstacle: the book on your pillow, the shoes by the door, the charger outside the bedroom |
| 5 | Start tracking, so you can see the chain grow |
| 6 | Plan for a bad day: decide your smallest version now, like one page instead of five |
| 7 | Look back. Which days worked? Adjust the time or the cue. Add a second habit only when the first feels easy |
Small habits, compounded
Habit formation isn't a dramatic overnight change. It's small, boring wins that add up over a couple of months, and then keep adding up for years.
So don't chase the result. Pick one problem, one tiny habit and one cue, and protect the streak. And when you miss a day, which you will, come back tomorrow.
Frequently asked questions
How long does it take to form a habit?
On average about 66 days, based on a 2010 UCL study, but it ranged from 18 to 254 days depending on the person and the habit. The popular 21-day figure isn't backed by research.
What is the habit loop?
It's the three-step pattern behind every habit: a cue that triggers the behaviour, the routine itself, and a reward that makes your brain want to repeat it.
Does missing a day ruin a habit?
No. In the UCL study, missing a single day didn't meaningfully affect how the habit formed. What matters is coming back the next day instead of giving up or starting over.
What's the best way to break a bad habit?
Interrupt its loop. Hide the cue if you can, and if you can't, keep the cue but replace the routine with something that gives you a similar or better reward.
Do habit trackers actually work?
Tracking helps because it makes your progress visible. A 2016 review of 138 studies found that monitoring progress toward a goal made people more likely to reach it, especially when the progress was recorded.
Does this sound like you?
Pick your problem and get one small habit to start with today.
Habits from this guide
- #habit formation
- #habit loop
- #habit stacking
- #dopamine
- #psychology
- #consistency
- #habit tracker
Written bySahil RanoutFounder, HabigrowKeep reading

Peak Focus
Can't Start Work? Why You Procrastinate (Even When You Care)
I can code all night but put off design decisions for days. Why procrastination is about feelings, not laziness, and the small habit that gets me started.
7 min read

Breaking Habits
How to Stop Scrolling in Bed: What Finally Worked for Me
I scrolled reels from 8 pm until 1 am for months, and screen-time limits never worked. Here's what finally did, and the research that explains why.
7 min read