{
  "id": 20822693,
  "title": "21 Days to Build a Coding Habit? The Real Study Found 66. Some People Needed 254.",
  "url": "https://urgent.news/2026/11/19/21-days-to-build-a-coding-habit-the-real-study-found-66-some-people",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-19T23:38:55.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/spartanrich430/21-days-to-build-a-coding-habit-the-real-study-found-66-some-people-needed-254-3ceo"
  },
  "original_language": "en",
  "account": "The well-known \"21-day rule\" for forming a habit originates from plastic surgeon Maxwell Maltz's observations of people adjusting to new features of their bodies. However, this figure did not stem from scientific research, but rather from his preface in a self-help book. The concept gained popularity over time and became a widely accepted belief.\n\nIn 1960, Maltz wrote in his book Psycho-Cybernetics that it usually takes about 21 days to create a noticeable change in one's perception. He cited examples such as patients getting used to a new face after surgery, the phantom limb sensation after amputation, and people finding a new house to feel like home.\n\nA more rigorous study conducted by Phillippa Lally and colleagues at University College London aimed to measure the actual time required to form a habit. They recruited 96 volunteers who each chose a small healthy behavior, such as drinking water with lunch or running for 15 minutes before dinner. Participants rated how automatic the behavior felt on a daily basis for 12 weeks. The results showed a gradual increase in automaticity over time, with a median time of 66 days to reach 95% of the plateau. The range of times varied from 18 to 254 days.\n\nInterestingly, missing a single day did not have a significant impact on the habit formation process. The curve of automaticity continued regardless of missed days. However, approximately half of the participants did not engage consistently enough to reach the desired automaticity level. This study suggests that forming a habit can take anywhere from a few weeks to several months, with the median duration being around two months.\n\nThe underlying mechanism behind habit formation involves the brain's adaptation to repetitive actions. In 1999, Ann Graybiel's lab at MIT recorded neurons in the striatum, a brain region, while rats learned a T-maze. Initially, the neurons fired during each run, indicating active engagement. As the runs became automatic, the brain's activity pattern changed, consolidating the routine into a single chunk that could be triggered by context. This process, called \"task-bracketing,\" allows for faster and more efficient execution of the habit.\n\nIn the context of coding habits, the curve of automaticity represents the brain's adaptation to repetitive coding tasks. During the initial weeks, the brain pays close attention to each line of code, akin to line-by-line compilation. Over time, the routine becomes more streamlined, and the brain stops processing the middle steps. This consolidation of the habit process is what the \"66-ish\" days represent.\n\nTo successfully establish a coding habit, the research suggests attaching the practice to a specific cue, such as opening the laptop or finishing a daily task. The cue should be consistent and occur at the same place and time each day. Additionally, the habit should be small enough to be manageable even on bad days, ideally lasting around 10 minutes. It is essential to plan for a period of two months rather than three weeks, as forming a habit can take longer than initially anticipated. If a day is missed, it is recommended to simply resume the habit on the following day, as a single missed day does not significantly affect the overall process.",
  "summary": "The \"21 days to form a habit\" rule came from a plastic surgeon watching people get used to their new noses. Not from a lab. Not from a habit study. From a preface. I went looking for it because I'd tried the 21-day thing twice with a daily LeetCode habit, and both times I quit somewhere around week four, feeling like I'd failed a test everyone else passes. Turns out the test was made up. Where 21…",
  "key_points": [
    "21-day rule originated from plastic surgeon Maltz's observations, not scientific research",
    "Study by Lally et al. found median habit formation takes 66 days, range 18-254 days",
    "Consistent practice, small manageable habit, and specific cue help establish coding habit"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}