Inappropriate and offensive joke telling is offensive and inappropriate.This is the lowest, unclever and cheapest form of humor around.
For something to get a laugh, it has to be unexpected. Generally it is taboo to joke about age, gender or race, so the unexpected inappropriate comment will often get a laugh, if only to deflect it and decrease tension.
Humor is personal so what one person thinks is funny, could be offensive to someone else.
The hit Tv show the office aside; Racist and prejudicial joke telling is never ok. Other employees should never condone the behaviour and there should be consequences. Nobody should be made to feel uncomfortable about who they are. Racist jokes are just a display of cultural ignorance.
Sexual humor should be off limits. Hard to believe people would joke about their colleagues sexual preferences at work, but they do. What someone does between the sheets is nobody else's business and should never be made light of at work. It could (and should) lead to discrimination charges. Men making fun of women's bodies at work is disgusting- not funny.
Also in poor taste is any form of slander and discrimination against others. Humor should be inclusive and never label people or groups in an inferior way.
Anything that makes people feel bad is not a welcome way to inject humor in the workplace. Lighthearted banter and joking boosts morale and laughs at the very thing that stresses you out. Taken to an extreme any form of humor in the workplace will offend.
If you feel your joking around has offended someone, immediately apologize.