I don’t like to play it safe, I think that sometimes “edgier” humour is most effective for the age group I teach. I will, for example, talk about sex and dating (it is a Biology class after all) but this is only directed a particular student when I’m certain they can take it.
I am reasonably adept at reading students, and I get a feel for who won’t mind being an occasional target or can be mildly embarrassed (usually in a classroom management context). For example, I threaten that I will answer calls if students leave their phone on; usually I don’t get to the phone in time, but I did once have a short conversation with a student’s girlfriend! He was embarrassed but knew he deserved it, and others made a point not to let it happen to them.
There are certain topics that are obviously off limits. In an international college, anything remotely racist, or aimed at particular cultures (though Canadian culture is fair game since I am the only Canadian born person in the class!) is taboo. I will never make light of a student’s personality or academic performance, and sexuality, if it ever comes up, is also off limits.
Some students take time to warm up to humour in the classroom, particularly if they are used to very strict educational systems where humour is an alien concept in the classroom. I am often sarcastic, and quickly realize that dry humour is much harder to pick out for ESL students. Similarly, I used to include random popular cartoon characters like Donald Duck to illustrate certain points in my lecture notes. I soon realized that my students didn’t recognize them!
My favourite thing in the classroom is when the occasional student makes fun of me or themselves. I know that I have created an environment where they feel comfortable doing that.