Sefer Chofetz Chaim Chapter 4 halacha 12

If one did speak lashon hara but no one accepted what you said so it didn’t harm anyone then you must repent to Hashem for transgressing a sin. (A) regret what you said, (B) admit your wrongdoing I.e vidui, (C) accept upon yourself altruistically to never do it again. However if they did accept what you said and it caused harm, physically, monetarily, or even psychologically then the speaker must first go over to the person he spoke about and apologize to him, and only then can he repent to Hashem. Neither Yom Kippur or death is sufficient atonement if you did not apologize to the person accosted if you are supposed to. There is an argument between the Chofetz Chaim and Rav Yisrael Salanter whether you must apologize to someone who does not know you spoke lashon hara about him. The Chofetz Chaim says you have to tell him that you wronged him and you apologize but Rav Yisrael Salanter says that might make him feel worse now knowing what happened and you shouldn’t make a person feel bad even if you apologize afterwards, therefore it is better to say nothing then to make things worse. The Chofetz Chaim in the Be’er Mayim Chaim (48) says something very scary that it is possible that Lashon hara might not immediately harm someone and a person will repent to Hashem and wipe out his sin but if later on harm does come to the one spoken about the sin resurfaces and the speaker must apologize to the one harmed. Best thing to do if already spoke is to try to avoid hard being done like going back to who he spoke to and convincing them that what he said was inappropriate and should not be accepted as truth at all. Then there would be nothing to apologize for.