Reviling Islam is kufr and apostasy from Islam, according to scholarly consensus. The one who does that has to repent to Allah sincerely, by regretting what he has done and resolving not to go back to it. If he repents, Allah will accept his repentance. Allah, may He be exalted, says (interpretation of the meaning):
Say: O Ibaadi (My slaves) who have transgressed against themselves (by committing evil deeds and sins)! Despair not of the Mercy of Allaah, verily, Allaah forgives all sins. Truly, He is Oft‑Forgiving, Most Merciful
It was narrated from Abu Moosa (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: Allaah holds out His hand at night to accept the repentance of those who have sinned during the day, and He holds out his hand by day to accept the repentance of those who have sinned at night - until the sun rises from its place of setting.
Narrated by Muslim, 2759
You have to repent and do a lot of righteous deeds. With regard to thinking about whether this was done in a state of anger or not, this comes under the heading of waswasah (whispers from the Shaytaan), who wants to divert you from repentance or weaken your fear of Allah and your efforts to do righteous deeds. If you understand the abhorrent nature and seriousness of what you did, that impels you to strive to do good and to instil in your heart humility before Allah; it makes you pin your hopes on His grace, kindness and pardon. But if your nafs makes falsehood attractive to you and detracts from the seriousness of the crime by claiming that it happened in a moment of anger, then this will weaken you resolve and distract you from turning to Allah.
It should be noted that anger is not an excuse in all cases; rather the anger that may excuse a person is anger in which he loses his ability of discernment to the extent that he does not know what he is saying. If this happened once, it does not happen repeatedly. Many of those who have the problem of reviling Islam could never revile their fathers or someone they hold in high esteem or the father of an opponent in an argument and the like, no matter how angry they become, but they do revile the religion because their hearts are devoid of faith and they are lacking in respect towards Allah, His Messenger and His religion. We ask Allah to keep us safe and sound. If there was any faith in his heart it would prevent him from reviling religion.
So ignore this waswaas (whisper). You have committed a grave sin, but you have a Lord Who is Most Merciful, Most Generous, Who accepts repentance of the one who repents, forgives sins, and replaces evil deeds with good deeds. So prepare to strive hard, fill your heart with veneration and respect towards Allah, may He be exalted, and His religion, read a lot of Qur'aan and do a lot of righteous deeds.
We ask Allah to accept your repentance and forgive your sin.
And Allah knows best.
Reproduced from Islam QA