Humor can be a fantastic coping mechanism for dealing with the most painful parts of life. It may seem distasteful to crack jokes about suicidal teachers, socially isolated teenagers, or souls who get tortured in Hell, but sometimes that's the only way to cope. Anime with dark humor isn't for the faint of heart or the easily offended - but if you're into it, it's some of the best comedy out there.
Examples of standout black humor anime include Sayonara Zetsubou-sensei, which follows a teacher who repeatedly tries to take his own life and persuade his students to do the same - all while managing to turn the whole thing into a giant joke. There's also Welcome to the NHK, a show in which a twenty-something suffering from paranoid delusions that keep him locked in his home tries to figure out how to rejoin society. If you want something a little more musical, there's Detroit Metal City, which depicts the extremely violent world of a death metal band.
All of these shows shake down their subjects for every ounce of humor they have to offer. You might leave them feeling unsettled, but you'll probably laugh, too.
Tomoko Kuroki is a deeply isolated teenage girl who is so terrified to speak to her classmates, but wants nothing more than to be popular. To deal with her extreme isolation, Tomoko comes up with scathing criticisms for her classmates - which she never verbalizes. It's a deeply upsetting situation, but her methods of trying to become popular are hilarious, like the time she tries to achieve shiny hair by not washing it for so long that she attracts ants.
In some ways, the comedy actually makes her pain more palpable - without the humor, it might have seemed like overkill.
When Nitta, a member of the yakuza, encounters a psychic child named Hina, his life is changed forever. If she doesn't use her powers, she'll set off dangerous explosions - which means that someone has to take charge of her. Nitta ends up reluctantly becoming her adopted dad. Some of the humor is wholesome, focused on the day to day relationship between the father and daughter - but some of it is super dark. One great example of this is Hina blasting rival yakuza members out of the window to their apparent demises as they yell "owie!" Another is when one of Hina's classmates ends up working as an exceptionally skilled bartender despite being a little girl. It's a deeply funny show, but some of its content is surprising, to say the least.
Hachiman Hikigaya is a high school student with a seriously depressing view on life. He believes strongly in a social hierarchy where he's at the bottom, and there is no way he can possibly change that. He feels deeply alienated from his classmates and from his own capacity for joy or human connection. While the series does take his warped view of the world and severe depression seriously at times, it also uses it as a major source of sarcastic humor.
Gintama is a show that mixes humor with extreme pain and suffering. Gintoki is a war veteran who makes his living doing odd jobs, and occasionally fights off aliens and other beings who threaten the safety of the human race. While many of the jokes have nothing to do with the show's more disturbing content, it's also not afraid to make jokes about death, torture, and other upsetting subjects.