When we hear hate speech or racism we are sometimes so shocked and surprised that we don't know how to react. An effective response is to simply say, "That is inappropriate."
For example, you hear someone respond to "Black Lives Matter", with, "All Lives Matter" or "White Lives Matter". You might say, "That is inappropriate and you are missing the point. If I said, we should give food to starving children, would you say that we should give food to all children? The Black Lives Matter movement is working to address inequalities in the justice system and to bring attention to the large number of blacks that have been killed." See Black Lives Matter vs All Lives Matter for an interesting discussion on the difference between "true" and "helpful".
In other cases an attack may be more agressive and it may be better to defuse the situation. One way to do this is suggested by the illustration on the right by artist Maeril. See: Defuse harassment
Another way to have your voice heard is to attend rallies, marches, and protests. The more we participate in democracy the louder our voice.
How to be visible allies.