Habits connect familiar situations with familiar actions
A habit is an action tendency strengthened through repetition in a recurring context. Sitting at a desk may prompt opening the same website before you consciously decide to do so. The context helps trigger the response, although habits are not irresistible and can still be interrupted.
Go deeper
A cue can start the sequence
Someone repeatedly checks a particular website immediately after sitting at a desk. Over time, the setting itself can begin to prompt the action with less deliberate consideration.
Habit automaticity develops when a response becomes strongly associated with recurring cues. Those cues may include a place, a preceding action or a particular time within a routine.
A frequent action is not necessarily habitual if it still requires deliberate planning each time. Conversely, a habitual response can begin before someone has consciously reconsidered whether it is useful today.
There is no universal number of days after which every habit forms. The action, context and pattern of repetition matter. A change in context can also weaken the cues that previously supported the response.