It can happen anywhere. Maybe you're waiting in the lobby of your doctor's office or studying at home for a big test—and then, without you even registering it, your fingertips are in your mouth and your teeth are gnawing away.

Even the people who do it tend to see nail biting as a nasty habit, but that doesn't make it any less prevalent. Twenty to 30 percent of people admit to biting their nails on a regular basis. Though reasons for the behavior vary, research has shown that most people do it because they need a psychological crutch, and not because they like having dirty, ragged fingernails.

According to Kieron O'Connor, a researcher at the University Institute of Mental Health at Montreal, there’s no one mood associated with nail biting. “People think you only bite when you’re stressed, but it’s not so simple,” O'Connor tells Mental Floss. “People will also bite when they’re bored and alone.” Nail biting feels good (in moderation at least), so when some people have nothing to do, or want to avoid the task in front of them, they bring their nails to their mouth out of habit. This same thing happens when nail biters feel overwhelmed by a stressful situation, or when they’re ruminating over some past behavior they feel embarrassed about. In all cases, nail biting is used as a mood regulator: a tool that distracts them or provides temporary relief or stimulation whenever an unwanted feeling comes up.

A study co-authored by O’Connor found that nail biting is more common in perfectionists. After speaking with 48 subjects, half with habit disorders like nail biting and half without, they found that the nail biters tended to be organizational perfectionists, or people who tend to over-plan, work too much, and become restless when they don’t have enough to do. “When people are perfectionists, they get bored and frustrated very easily and hold themselves to higher standards,” O’Connor says. “They plan too much, and when they can’t do all of it they have a sense of failure.”

So what is it about nail biting specifically that makes some people turn to the behavior when they’re feeling less than fantastic? Like many of our worst habits, nail biting is an evolutionary adaptation kicked into overdrive. Even before we had access to aisles worth of beauty products, humans practiced self-grooming, which includes getting rid of the occasional hangnails. But even nail biters with short, clean nails will engage in the behavior: They use it as a way to get the mental reward our brains associate with grooming without any of the cosmetic benefits.

Nail biting manifests itself at different levels of intensity. At one extreme there’s onychophagia, a condition where compulsive nail biting requires medical attention. Like skin picking and hair pulling, nail biting can be a symptom of a body-focused habit disorder. When it gets to the point that someone is harming themselves by chewing their nails so often, they usually require a mental health professional to help them curtail the behavior.

But for far more people, nail biting is just an annoying habit that’s hard for them to quit—no matter how much the squeamish people around them wish they would.

Have you got a Big Question you'd like us to answer? If so, let us know by emailing us at bigquestions@mentalfloss.com.