Moderation is the safest form of flattery.

On the campaign trail, President Trump threatened to label China a currency manipulator and accused the country of “raping” the American economy. But during his recent five-country Asia trip, he showered Chinese leader Xi Jinping with compliments — giving the nation “great credit” for taking advantage of the U.S. and affirming his “great respect” for Xi. “My feeling toward you is incredibly warm,” Trump said. “We have great chemistry.” (POTUS, meanwhile, was on the receiving end during his now-infamous, praise-lavishing first cabinet meeting in June.)

From the global stage to the workplace, flattery can be useful when administered properly. “Everybody loves to know that they’re valued and appreciated and that you really enjoy being around them,” career coach Roy Cohen told Moneyish. “So an occasional reminder is not a bad thing.”

But experts agree there are limits and caveats. Here’s how to flatter a boss or colleague without alienating everyone in the room:

Also read: Why you don’t have to drink to fit in with your co-workers

Know your audience “so that the message resonates,” executive coach and author Bonnie Marcus told Moneyish. “Some people, if you know them well, you know they’re no-nonsense; they really don’t want to hear that stuff. Others feed off of it. So … whatever you’re trying to communicate, you need to understand who the audience is and what resonates with them.”

Be aware of how flattery may be received. Tread carefully around potential cultural or gender issues, said career coach Roy Cohen. While women may appreciate compliments from other women on their appearance, Marcus added, it’s best to steer clear of commenting on the opposite sex’s physical attributes.

Cohen, meanwhile, greenlit giving harmless compliments on appearance: “If somebody happens to look great, as long as it’s a neutral comment and is not in any way sexualized, then I think it’s perfectly fine,” he said. “Why shouldn’t we say to folks, ‘Hey, you look great today’?”

Be specific. It’s better to compliment someone on their valuable contribution to a meeting than to lavish them with vague, effusive praise about how amazing they are, said Marcus. “Something that’s really based in reality is what resonates most with people,” she said. “Just going on and on and on, I think, can be too much … Stick to the point.”

Also read: When should you steer clear of nicknames — like Trump’s “Rocket Man” — at work?

Be sincere. “When flattery is insincere, it will always come back to bite you in the ass,” Cohen said. “(For) even the most self-absorbed among us … if it’s just unmitigated and relentless, we know that it’s not real. So we question the individual’s motives.”

Keep compliments short and rare. “It’s a five-second thing: ‘Hey, man, you nailed it with a client today,’” leadership expert Todd Dewett told Moneyish. “The real key rule to remember is a little, on occasion, can be useful. A lot, consistently, is almost never useful.”

Be self-aware. Morale could suffer if a boss is constantly complimenting one employee over the others, Cohen said, and frequently flattering a boss may make it seem “like you’re competing” or resorting to brownnosing. Most bosses will sniff out brownnosing and won’t appreciate it, Dewett said, while coworkers will see you as an “insincere person groveling at the boss’s feet.”

When in doubt, keep the comment to yourself or ask a coworker for advice, said Cohen. You might even empower a colleague to give honest feedback on your behavior, said Dewett: “Most people who over-flatter aren’t good at reading others … A different pair of eyes is usually the best answer for them.”