Hilchos Lashon Hara chapter 4, section 12
If someone already spoke lashon hara about another person and now wants to do teshuva (repent), it depends on what happened.
If the listeners did not accept the words, and the person spoken about was not lowered in their eyes, the speaker is left only with the sin against Hashem. To fix it, they must regret what they did, confess, and decide that from now on they will not speak lashon hara again.
But if the person was lowered in the listeners' eyes because of the story, and suffered physical or financial harm, it is like every sin between people: even Yom Kippur and the day of death do not bring atonement until the speaker makes peace with the person. Only after the person forgives them is the speaker left with the sin against Hashem alone. And even if the person does not know at all that they were spoken about, the speaker must tell them what was wrongly done against them and ask for forgiveness.
From this we can understand how bad this habit of lashon hara is. Someone who is used to it can almost never do teshuva. They surely will not remember all the people they spoke about. And even the people they do remember don't know about it, and the speaker will be embarrassed to tell them in order to ask forgiveness. Sometimes they also speak about a "flaw" in someone's family and cause harm for generations – and for this there is no forgiveness. As our Sages said: "One who speaks of a flaw in a family has no atonement ever."
So one must stay very far from this bad habit, so as not to reach a state of "what is crooked cannot be made straight" – damage that can no longer be fixed.