I’ve been biting my nails ever since I can remember. I do it automatically, without even realizing it: I’m focused on writing a story, and before I know it, my finger is in my mouth and I’m greedily chewing a nail or a cuticle. I hate that I bite my nails; it makes me feel ashamed, and I’ve tried quitting multiple times. So why do I keep doing it? The answer is more complicated than you’d think.

Scientists, in fact, are still trying to figure out exactly why people bite their nails. But they do know that it’s a habit for a lot of us: about 20 to 30 percent of the population are nail biters, including up to 45 percent of teenagers. I thought that nail biting was a sign of nervousness or anxiety, but research shows that’s not necessarily true. People bite their nails also when they’re bored, hungry, frustrated, or working on difficult tasks. Also — and this is where the shame kicks in — it feels good.

I know that might sound impossible. Often if I go too far, I get a bloody finger and my nails hurt. But the act itself of biting a nail or cuticle actually feels rewarding. Tracy Foose, an associate professor of psychiatry at UCSF School of Medicine, agrees. She’s also a nail biter and she says she does it because she likes it. “It does feel relaxing when I do it,” Foose says.

The theory that nail biting is somewhat connected to pleasure is suggested by some animal studies, Foose says. In these studies, when rats were given chemicals that decrease the perception of pain, called endorphins, they groomed less. If those pain-killing endorphins were blocked by drugs, the animals groomed more. This behavior seems to suggest that grooming is pleasurable. So when we bite our nails — a form of grooming — we might get a kick out of it.

If nail biting is like the rats’ grooming, it might explain why people bite their nails during stressful situations or while engaged in difficult tasks: we go to nail biting for comfort. The “soothing” theory is also supported by recent research connecting nail biting to perfectionism. Nail biters are perfectionists, people who over-plan and get frustrated quickly if they’re idle, says Kieron O'Connor, a professor of psychiatrist at Montreal University. So chewing on a nail may help these people soothe their boredom and irritation. “Perfectionism is a big element, a big ingredient in triggering the problem,” O’Connor says.

“Perfectionism is a big element.”

Some research shows that nail biters could also be just genetically predisposed to the bad habit. A third of nail biters state that they have a family member who bites their nails as well, says Shari Lipner, an assistant professor of dermatology at Weill Cornell Medicine who’s researched nail biting. And when you look at identical twins, Lipner says, it’s very common that both children bite their nails.

It’s not clear why nail biting starts at a young age. But it could be that it’s easy for children to fall into the bad habit because the part of the brain that’s responsible for decision-making, called the prefrontal cortex, is still developing, Foose says. So the underdeveloped prefrontal cortex means children are more impulsive than adults: they can’t stop themselves from eating all the Halloween candy and they pick their noses in public because social pressures don’t affect them as much.

“They do all sorts of stuff that we might be tempted to do as adults but we’re like, ‘Oh no! I can’t do that!’” Foose says. “We have a brain that can actually stop us from picking our nose. Kids, not so much.”

In 2012, the American Psychiatric Association decided to list nail biting and other pathological grooming behaviors like skin picking and hair pulling as obsessive compulsive disorders, or OCD. OCD includes people washing their hands over and over, or lining up their shoes compulsively. Pathological grooming and OCD are somewhat similar: in both cases, a natural behavior — in this case, nail biting — is turned into an excessive one. But some psychiatrists disagree with the American Psychiatric Association’s decision. Though it’s true that nail biters sometimes have other psychiatric disorders like ADHD and separation anxiety disorder, OCD is an anxiety-driven obsession, while nail biting is not, they argue.

“As an anxiety specialist, I think that was an overreach for lumping disorders,” Foose says. O’Connor agrees: “I really don’t think it’s an OCD at all. It doesn’t seem to fit any criteria.”

Whatever the medical definition of nail biting, doing it can have a lot of unwanted health consequences. First of all, it’s bad for your teeth and even your jaw. Nail biting can result in up to $4,000 in additional dental bills over your lifetime. Second of all, it’s dirty. The area under the nail is a “great breeding ground for bacteria,” Foose says, including E. coli. When you bite your nails those bacteria are carried inside your body and can cause gastrointestinal problems, like nausea and diarrhea, Lipner says.

The mouth is also home to a lot of bacteria, some of which can cause a nail infection. Warts and herpes can also be transmitted from your mouth to your fingers and vice versa, Lipner says. “Almost the two dirtiest parts of your body are hanging out together as you bite your nails,” Foose says. “I’m kind of making myself not want to do it as I say that.”

“Great breeding ground for bacteria”

Is that reason enough to stop? I’ve tried multiple times, with bitter nail polish, manicures, and even a device that gives you electric shocks to break bad habits. Wearing gloves or wrapping your nails in tape or bandaids can work, as is replacing the habit with another one, like using a stress ball or running your hands over worry beads, Foose says. Relaxation and meditation, techniques used to treat perfectionists, can also work, O’Connor says.

But if nail biting is about comfort, then perhaps quitting is about replacing that habit with something else comforting. For me, that’s reading Harry Potter in bed or petting the nearest available dog or eating homemade pizza. Not sure how feasible all that is during work hours, but I can check with my boss.

Update November 15th, 2017: This story was originally published on November 13th, 2016; it’s been updated to include video.