Humor. We underestimate the importance of comedy at great peril. It's not just that we all need a therapeutic laugh from time to time (we do) it's that humor is a critical agent of social development. Humor helps us relieve the pressure of social conformity by taking taboo subjects and making us laugh about them. Humor is about the only power in the 'verse capable of making us look directly into our shadow side and not have a break down.
Humor can tear down a tyrant. Humor can destroy a deadly cultural meme. Humor prevents warfare, probably daily. Humor helps us see clearly, to know what is true, and to overcome stubborn internal prejudices.
Of course, that is to spin it positively. Humor can also hurt. In fact, most humor involves pain for someone. As the classic saying goes tragedy is when I cut my finger. Comedy is when you cut yours. This safety relief valve of laughing at our pain and the pain of others is necessary and valuable, but is it always justifiable? Is there some humor which just goes too far?
Subjectively, each of us will have our own lines. Something I find offensive may still be funny to you, and vice versa, but are there certain lines which no one should cross? Are there certain jokes which should be unacceptable for anyone to tell or laugh at?
From an ideological standpoint I want to say no. Part of the point of comedy is that it is anarchic. It fundamentally refuses to recognize any boundary or authority as legitimate. Nothing is sacred. That is important to how comedy works and why it can fulfill the role it does in society. Because we are always going to want to censor something and usually not for legitimate reasons. By being ungovernable comedy saves us from our own impulse to control and dictate what is appropriate. That very impulse usually comes around to bite you in the back.
However, I know there are jokes I personally will never find appropriate and jokes I've told which I regret. Coming into contact with close friends and family members who have experienced rape, it is hard for me to find any humor in rape-jokes and I recognize strong arguments for why such jokes should be unacceptable. If the power of humor is to take taboo things and make them acceptable for public conversation are there not things which should always remain taboo? Do we ever want to be a society where the violent sexual assault of other human beings is treated lightly? It's tragic that we are in fact such a society right now.
I don't think there is a clear bright line. Even if we could find one and draw it I hope we would never be able to enforce it. Comedy is too essential to what it means to be human and too powerful a force for good to be allowed to be muzzled. Still, take care with what jokes you tell and what you choose to laugh at. Someone next to you may be silently reliving a personal nightmare. To them it may not be funny at all.