I often think if someone were to see me and my online friends in our group chats, they'd think we were horrible racists, but the thing is we just make stupid jokes because we all know none of us are taking it seriously. I have a black friend in that group who's like a brother to me, and I make racist jokes at him all the time, and he takes it in stride, and usually makes a witty comeback of his own.
That said, I find it completely disgusting when people go out and harass other people like that. I would never say that kind of stuff in public, not because I'm like... afraid of getting shot or any stupid reason like that, I just know that other people would get very rightfully offended.
However, the honest truth is that they were probably not really racists, they were just engaging in the national pastime of the internet: trolling. Simply put, there's two ways to handle that. Either confront them and have fun arguing with them, or just ignore them. Just don't take them seriously, that's the key.