The Joker is Probably Completely Sane and Just Uses his Public Image of Being Insane to Keep Others Underestimating Him as Just Some Lunatic
The man regularly outwits far more supposedly cognizant opponents including Batman and Lex Luthor, who are canonically recognized as two of thr smartest people on the entire planet.
Edit: I'm not saying insane people are stupid, I'm saying that Joker's mental illnesses are pretty obviously behavioral, they don't affect his perception of reality. He's perfectly capable of understanding what he's doing and how it's wrong, in fact his character almost doesn't work if he doesn't, he just thinks that it's all hilarious anyways. That's why I said he's not insane, he just pretends to be, because he'd be fit to stand criminal trial as fully competent and cognizant of his actions.
My point is that he doesn't have a warped perception of reality (in the diagnosable sense), being criminally insane would require that he be incapable of understanding what he's doing and/or the reasons why doing those things are wrong.
Joker not only is perfectly capable of understanding he's doing wrong and why the things he's doing are wrong, to him that's the entire fun of the joke.