There’s something uniquely cathartic in complaining to your colleagues about your shared place of work. Unlike your real friends, your work friends understand your specific office grievances, and can commiserate with you about the micromanaging boss’s assistant and/or the broken elevator that always makes you late.

But there’s such a thing as blowing off too much steam. “A Debbie Downer sometimes changes the whole workplace climate,” says organizational psychologist Amy Cooper Hakim, the author of Working with Difficult People, and it’s hard to do good work when Susan is Slacking you every 15 minutes to whine about how nobody respects her. In excess, office complaints can turn into toxic negativity that hurts your performance and quality of life, leaving you focused on the bad qualities of your workplace and blind to the good ones.

Psychologist Goali Saedi Bocci says that while venting can be beneficial for employees, it’s not hard to take it too far. “I think this is something that’s very common. We go from venting — which I think can be healthy and can be great, it’s support — but it can start to creep into the constant complainer,” she says.

“You don’t want to be that person who is always tattling on your colleague.”

If you feel that some of your colleagues are zapping too much of your energy with their complaints, here are some tips to keep the grumbling at bay.

Know when a line has been crossed.

The evolution from healthy venting to toxic complaining can happen slowly, making it hard to tell if and when the change has taken place. Saedi Bocci suggests tracking your own moods after dealing with a co-worker whose complaints are starting to feel like a drag. “When you walk away from the conversation, how are you feeling?” she says. “Is it that every time this colleague comes into your office you feel weighed down, [or] you feel not quite as excited to see them?” In this case, the negativity is likely wearing on you, and it might be time to take action.

That’s especially true if the venting is specifically directed at you. “When an individual displays extreme emotions — yelling, berating, bullying, etc. — that is always negative. In extremes, it can and does lead to a toxic work environment,” Ronald Riggio, a professor of leadership and organizational psychology at Claremont McKenna College, writes in an email. “If the emotional venting is extreme, repeated, and isn’t followed up with an apology, then we are getting into the ‘toxic’ category.” (Do note that you should go to higher-ups if someone’s behavior is harmful and abusive toward you. “‘Out of bounds’ toxic behaviors,” says Riggio, “have no place in the work setting.”)

Set boundaries.

It’s nice to have some friends in the workplace, but you don’t have to be buddies with everyone. If people are barging in on you to unload their baggage when you need to get stuff done, it’s fine to ask them to leave you alone. “It’s okay to just be professional,” says Hakim. “We don’t need to hear everybody’s deep dark secrets, or need to see dogs on Facebook, or hear about gripes in different departments, unless it specifically relates to our job.”

Saedi Bocci suggests closing your office door, or, if you don’t have a door, verbally letting colleagues know that you’re unavailable to chat during work hours. “I think workplace boundaries can be helpful because it’s not personal,” she says. “You don’t want to be antisocial, but I would see it as, ‘I’m going to get all my work done, and then once it’s done, then I might open the door.’”

She adds, “Sometimes you’ll be in a cubicle situation so it might not be as accessible, but saying, ‘Hey, I’d love to talk at the end of the day, I have a bunch of emails I need to get to,’ or ‘I’m running behind on this project,’ can, at least, be a way of punting it until you have more mental energy.” You can also try wearing headphones to make yourself less approachable, set yourself to away on Slack, or turn off notifications to avoid any digital interruptions.

Try to confront your co-worker directly.

If your signals to stay away aren’t keeping out the complaints, try to first address the negativity with your co-worker before getting higher-ups involved. “You don’t want to be that person who is always tattling on your colleague,” Hakim says.

Sometimes, you can frame over-venting as an office-wide problem, so it doesn’t look like you’re blaming one person. “You don’t want to make it too lighthearted of a thing, but maybe laugh it off and say, ‘Hey, we’re always complaining, maybe we should think of something positive,’” Saedi Bocci says, noting that she successfully tried that approach in graduate school with a women’s support group that would occasionally snowball into a venting session.

Sometimes, your colleague doesn’t realize their behavior is bringing you down, in which case it’s fair to (politely) tell them outright that they’re making the workplace difficult for you, and you need them to rein it in. “If you can be direct, that’s ideal,” Saedi Bocci says.

“By trying to make everybody happy, you can kind of end up a doormat.”

And remember that you do not need to be your colleague’s best friend. “Take emotion out of the situation, so you don’t have an emotional tie to [the] individual,” Hakim says. “Be kind and professional, responsible and responsive. But if a colleague comes to you and wants to complain about something going on in a different department, tell them, ‘I’ve got a tight deadline. I need to get back to it.’ Create a boundary without being rude, and state the obvious: you’re at work to work.”

If you need to escalate, do it strategically.

If talking to your colleague directly doesn’t work, and their behavior is still affecting you, it’s time to get someone else involved. But Saedi Bocci cautions against going directly to HR right away. “I would start to go to supervisors, other colleagues, to figure out how to handle the situation,” she says. Sometimes, looping in another person can be enough to get the colleague off your back: “The sensitive thing can be to talk to other people and say, ‘I know Julia is having a rough time. She tends to corner me a lot. Next time you see her come over to my cubicle, do you think you can swoop in and say, “Let’s go to coffee”?’”

And if all that fails, you do need to get your boss and possibly HR involved, lest your work performance fall. “You want to be professional, to try to minimize any conflict, and be sure you can be good team player,” Hakim says. “But you should be able to say, ‘Hey boss, I need some help. I do not feel comfortable working with this individual. I know it’s in the interest of the company for me to get my job done, but this is distracting. What do you suggest?’ It’s very important that you’re constructive and not seen as a complainer.”

Don’t be the problem.

If toxic negativity is a problem in your workplace as a whole, don’t contribute to it. If you need to complain about your boss, or workload, or schedule, or negative coworker, do it to a friend outside of work, or keep a journal you can scribble in when you get frustrated. In addition to preventing you from adding to the office negativity, this also spares you possible blowback.

“Most of the people you work with are not your friends,” Hakim says. “I really encourage you to avoid any kind of venting, even if it’s after hours, with a colleague. They might take what you say and turn it against you at [a] point where it helps them to advance in their career.”

Keep in mind your colleague is a person, too.

There are people who are just intrinsically negative; there are also people whose personal and inner lives are so negative that that spills into the workplace. “The negative colleague might be somebody who is clinically depressed. They’re literally seeing things through a negative lens,” says Saedi Bocci. “They may be completely oblivious to it.” If you’re comfortable reaching out to offer support, then do.

While you’re not obligated to be their therapist, it might help to keep in mind where the toxicity comes from. “If you are able to remember that, and also recognize people have their own experiences that have nothing to do with you, it can perhaps invoke a little compassion or empathy,” Hakim says, which could inspire you to give your colleague a little more leeway. “It might make it easier to remove ourselves and say, ‘Let me get what I need from [this] person and move on with my day.’”

But don’t ignore toxicity to the point where people feel comfortable walking over you, and speak up if you feel you must. “You’re really trying hard. You don’t want to lose your job. You want to make everybody happy, but by trying to make everybody happy, you can kind of end up a doormat,” says Saedi Bocci. “That’s part of that balance.”