Short answer
Yes, Allah forgives zina for anyone who repents sincerely: stop it, regret it, resolve never to return, and turn to Allah with prayer and good deeds. Keep the sin hidden; you do not have to confess to anyone. The four schools agree.
Tawbah (repentance) from zina is fard and should be immediate. Its conditions are leaving the sin, regret and a firm resolve not to return. Covering one's own sin is better than confessing it, and the person is not required to report himself to anyone.
The four schools agree on this.
Explanation
Many people who have fallen into zina feel they are beyond forgiveness. The Quran says the opposite. Right after naming zina among the gravest sins, Allah makes an exception for those who repent, believe and do good, and says He will replace their evil deeds with good (25:70). He also tells those who have wronged themselves never to despair of His mercy, because He forgives all sins (39:53).
- Stop completely. End the relationship, delete the contact and remove what leads back to it.
- Regret. Real sorrow in the heart is the core of tawbah.
- Resolve. Intend firmly never to return. If you slip again, repent again. See repeating a sin.
- Turn to Allah. Pray two rakats of salat al-tawbah, say istighfar, and use a dua for forgiveness. There is no special dua for zina; any sincere dua in any language is heard.
- Add good deeds. Charity, prayer and fasting help wipe away sins.
Keep it hidden. The Prophet ﷺ said that all of his ummah will be pardoned except those who expose their own sins. You do not need to tell your parents, an imam or a future spouse. The hadd punishment belongs only to a Muslim court with strict proof, and repentance between you and Allah is enough. See punishment for zina.
If the person you were with is suitable, you may marry them with a proper nikah after repenting. If there is a pregnancy, or the zina involved a married person, ask a mufti about the details. The general steps are in how to repent.
The evidence
Quran, Surah Al-Furqaan 25:68-70
وَٱلَّذِينَ لَا يَدْعُونَ مَعَ ٱللَّهِ إِلَٰهًا ءَاخَرَ وَلَا يَقْتُلُونَ ٱلنَّفْسَ ٱلَّتِى حَرَّمَ ٱللَّهُ إِلَّا بِٱلْحَقِّ وَلَا يَزْنُونَ ۚ وَمَن يَفْعَلْ ذَٰلِكَ يَلْقَ أَثَامًۭا ﴿٦٨﴾ يُضَٰعَفْ لَهُ ٱلْعَذَابُ يَوْمَ ٱلْقِيَٰمَةِ وَيَخْلُدْ فِيهِۦ مُهَانًا ﴿٦٩﴾ إِلَّا مَن تَابَ وَءَامَنَ وَعَمِلَ عَمَلًۭا صَٰلِحًۭا فَأُو۟لَٰٓئِكَ يُبَدِّلُ ٱللَّهُ سَيِّـَٔاتِهِمْ حَسَنَٰتٍۢ ۗ وَكَانَ ٱللَّهُ غَفُورًۭا رَّحِيمًۭا ﴿٧٠﴾
And those who do not invoke with Allah another deity or kill the soul which Allah has forbidden [to be killed], except by right, and do not commit unlawful sexual intercourse. And whoever should do that will meet a penalty. Multiplied for him is the punishment on the Day of Resurrection, and he will abide therein humiliated - Except for those who repent, believe and do righteous work. For them Allah will replace their evil deeds with good. And ever is Allah Forgiving and Merciful.
Even zina is forgiven and turned into good for the one who repents and reforms.
Quran, Surah Az-Zumar 39:53
۞ قُلْ يَٰعِبَادِىَ ٱلَّذِينَ أَسْرَفُوا۟ عَلَىٰٓ أَنفُسِهِمْ لَا تَقْنَطُوا۟ مِن رَّحْمَةِ ٱللَّهِ ۚ إِنَّ ٱللَّهَ يَغْفِرُ ٱلذُّنُوبَ جَمِيعًا ۚ إِنَّهُۥ هُوَ ٱلْغَفُورُ ٱلرَّحِيمُ ﴿٥٣﴾
Say, "O My servants who have transgressed against themselves [by sinning], do not despair of the mercy of Allah. Indeed, Allah forgives all sins. Indeed, it is He who is the Forgiving, the Merciful."
No sin is too great for Allah's forgiveness.
Sahih al-Bukhari 6069
Sahih... كل أمتي معافى إلا المجاهرين ...
"All of my ummah will be pardoned except those who make their sins public."
A person should conceal his own past sins, not announce them.
Sahih Muslim 1696
Sahih... لقد تابت توبة لو قسمت بين سبعين من أهل المدينة لوسعتهم ...
"She has repented with a repentance that, if it were shared among seventy people of Madinah, would be enough for them."
Said of a woman who had committed zina, showing the worth of sincere repentance.
Where the ruling is recorded
- Radd al-Muhtar (Ibn Abidin), Kitab al-Hudud, opening discussion. Concealing a sin that falls under the hudud is better than confessing it.
- Bada'i al-Sana'i, Kitab al-Hudud. The judge should turn away a confessor and suggest doubts, which shows the law prefers repentance to punishment.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.