Whether it's every once in a while or almost all the time, negative thoughts can barrel their way into our brains. It's obviously not healthy if you let them fester, so it's key to find a way to stop them. Here are five good ways to deal with negative thoughts when they've invaded your head.

Talk about it.

Most people try to push negative thoughts out of their minds with little success. It’s like the old joke goes, if I tell you not to think of purple polka-dotted elephants, you’re going to think about just that! A study published in 2005 in the journal Behavior Research and Therapy finds that the best way to get rid of negative thoughts for good is not to suppress them, but to accept them. Talking about those feelings, getting them out of your head and giving them words and labels instead of pretending they don’t exist, can go a long way toward easing your emotional distress.

Write about it.

Similar to the tactic mentioned above, writing about your feelings may help you get rid of them for good. University of Virginia psychologist Tim Wilson tells Business Insider that writing about your negative feelings as often as three times a week can help you let go of them for good. Putting pen to paper is another form of acceptance, because by writing the thoughts down, you're acknowledging their existence.

Practice mindfulness.

What is mindfulness exactly? Scientist, writer and meditation expert Jon Kabat-Zinn, Ph.D. describes it in his book, "Wherever You Go, There You Are" like this: "Mindfulness practice means that we commit fully in each moment to be present; inviting ourselves to interface with this moment in full awareness, with the intention to embody as best we can an orientation of calmness, mindfulness, and equanimity right here and right now." A study being conducted over the next seven years in the United Kingdom by psychologists and neuroscientists at Oxford University and University College London is attempting to discern the effects of mindfulness on adolescents. Said the study’s lead author, William Kuyken, “Just as going for a run is a well-known way of protecting general physical health, mindfulness exercises develop mental fitness and resilience.”

Focus on the good.

In her book, “Easy to Love, Difficult to Discipline,” internationally recognized expert in childhood education and developmental psychology Dr. Becky Bailey describes one of her tactics for building a better relationship with your kids. By focusing on the positive aspects of disciplining your children, i.e. what you want to happen as opposed to what you don’t, you can break the cycle of negativity in your home. She puts it this way, “What you focus on, you get more of…. Learning to focus your attention on the outcomes that you desire will bring you enormous power. It is probably the most important technique you can learn for living peacefully with children (and with other adults) and finding joy in life.”

Distract yourself.

Distracting yourself with a feel-good activity can also be an effective way to free your mind from negative thoughts, especially if you’re just trying to get rid of them for a short period of time. For me, this is especially true on a plane, where my larger-than-life fear of flying once led me to scream out for the entire plane to hear, “We’re all going to die!” when we hit a bit of bad turbulence. (Oh how I wish I was making that up.) But I find it much easier to fly with my kids, distracting myself with occupying them with snacks and games as opposed to letting myself wallow in my negative thoughts. And what I know anecdotally to be true is backed by science. Says Dr. Becky Weinberg, Pittsburgh-based clinical psychologist, “Distracting yourself with something like exercise or another pleasurable activity can definitely help you shift focus.”

We all have negative thoughts, so the next time you do, try one of the strategies above to banish them for good.

5 ways to stop negative thoughts
Negativity can creep into our brains, but here's how to deal when negative thoughts invade your head.