Al-’Allaamah Rabee’ Ibn Haadee al-Madkhalee
[Q]: Does sincere tawbah (repentance) erase all of that which has preceded it from sins?
[A]: Allaah the Exalted said,
“Say: O My servants who have transgressed against themselves (by sinning), do not despair of the mercy of Allaah. Indeed, Allaah forgives all sins. Indeed, it is He who is the Forgiving, the Merciful.” [Sooratuz-Zumar 39:53]
So these sins of yours, regardless of whether they have occurred in private or otherwise, once you have repented with a truthful repentance, a sincere repentance (tawbah), then Allaah will forgive you for whatever has preceded.
So from Abee Sa’eed al-Khudree (radiyallaahu ’anhu), that the Prophet (sallallaahu ’alayhi wa sallam) said, “There was a man amongst those who came before you who killed ninety-nine people. So he asked about the most knowledgeable of the people in the earth. So he was directed to a monk. So he went to him and said, “I have killed ninety-nine people. So is there a tawbah for me?” So the monk replied, “No.” So the man killed him an completed one hundred people with him.
Then he asked once again about the most knowledgeable person in the earth. So he was directed to a Scholar. So he said, “I have killed one hundred people. So is there a tawbah for me?” So he replied, “Yes. And who stands between you and the tawbah? Move to such and such a place. Since, over there are people who worship Allaah. So worship Allaah with them and do not return to your land, since it is an evil land.” So he travelled half way there and then death overtook him. So the angel of mercy and the angel of punishment argued over him. So the angel of mercy said, “He came repentant, with a heart devoted to Allaah.” And the angel of punishment said, “He did not do any good, ever.” So an angel came to them in the form of a human being. So he arbitrated between them. So he said, “Measure his distances from the two lands. So whichever one he died closer to, then that is his end. So they measured the distances and found that he was closer to the land he had intended. So the angel of mercy took him.” Qataadah (d.104H) said, ‘So al-Hasan said, ‘He mentioned to us that as death approached him, he crawled upon his chest.” 
And there occurs in one of the narrations, “Indeed, Allaah said to the previous land, ‘Distance yourself from him.’ And He said to the other land, ‘Draw closer to him.’” And this is from the virtue, generosity and mercy of Allaah.
The point is that all sins: Shirk, kufr (disbelief), ilhaad (apostasy), zandaqah (heresy), zinaa (adultery, fornication), consuming intoxicants, drawing pictures, or any other sin… Once the servant repents from it with a sincere tawbah, then Allaah accepts this tawbah and he expiates these sins from him, except for the rights of the servants.
So there is a record of sins that are not forgiven and that this Shirk and kufr. And there is a record of sins that are not abandoned and that is the rights of the servants. So it is obligatory for these sins to be resolved in this worldly life before the Hereafter. So there is no deenaar or dirham, they are only good deeds. So this oppressed individual takes from your good deeds and that oppressed individual takes from your good deeds and so on. So if something remains with you after that, then you will enter Paradise. And if you do not have any good deeds left, and you still owe them something, you will take on their evil deeds and then you will be punished for those sins. 
: Related by Muslim (no. 2766), Ibn Maajah (no. 2622) and Ahmad in al-Musnad (no. 10770).
: Refer to Fataawaa Fadeelatush-Shaykh Rabee’ Ibn Haadee al-Madkhalee (1/140).
Translation by Maaz Qureshi