Actually, by today's standards in America, "... the hell" is pretty tame, and among friends, including females, it is not at all offensive. But using it with strangers, it takes on a more serious meaning -- depending on how and when you say it. In a clearly humorous situation, it can be a funny remark. In a confrontation, it may trigger a war of words, but probably not violence ... probably -- there are lots of crazy people out there, so unless you are bigger than the stranger, better hold your tongue.
And it is one of those idioms that can stand by itself, but requires different "tones" (as in Chinese) for different situations:
~You hear a loud crash from just outside your house where your car is parked ...
... "What2 the4 hell2 ... ?!!" ( "... was that?" is understood and unstated)
~Your girlfriend is begging and begging you to watch a DVD you hate, until finally (because she is so cute), you give in ...
... "Oh1, what1 the1 hell4 ..." (... I give up. You win.)
~You walk into the kitchen in the morning to find the floor is flooded with water ...
... "Oh4, what4 the4 hell4 ..." (... how did this happen?)
With a little practice and careful listening, you can say it just right in any situation. And if you don't, well ... what2 the4 hell4. (... no big deal)