Short answer
Yes, it is still haram, and the winnings are not yours. Return them to the person you won them from if you can. When that is not possible, as with a casino, lottery or betting app, give the money to the poor without hoping for reward, then repent and stop.
Money won by qimar (gambling) is not lawfully owned. It must be returned to its owner if known and reachable; otherwise it is given in charity on his behalf, without the intention of reward. Past losses cannot be deducted from the winnings.
The four schools agree on this.
Explanation
Winning does not change the ruling. The Quran calls gambling "defilement from the work of Satan" (5:90), and the sin is in the contract itself: each side stakes money on chance, and one takes the other's wealth without giving anything in return. That is consuming wealth unjustly (2:188), whether you end up up or down.
What to do with the money:
- A bet with a person: give the money back to the one who lost it.
- A casino, lottery, scratch card or betting app: most Hanafi muftis say give it to poor people, without hoping for reward, since you cannot return it to the many players whose stakes made up the prize.
- Things you bought with winnings: you may keep them, but give away an amount equal to the winnings you used.
- Past losses: you cannot keep part of the winnings to make up for earlier losses. The losses were part of the same sin.
The money does not count as your zakat or sadaqah, because Allah accepts only what is pure. You are giving it away to rid yourself of it, not to earn reward.
Then repent: regret what you did, stop, and resolve not to return. Delete betting apps and block gambling sites. If gambling has become a habit you cannot break, speak to someone you trust and seek help; the door of repentance stays open. See Can a Muslim gamble?, Is the lottery haram? and What should I do with haram money? The four schools agree that gambling winnings are unlawful.
The evidence
Quran, Surah Al-Maaida 5:90
يَٰٓأَيُّهَا ٱلَّذِينَ ءَامَنُوٓا۟ إِنَّمَا ٱلْخَمْرُ وَٱلْمَيْسِرُ وَٱلْأَنصَابُ وَٱلْأَزْلَٰمُ رِجْسٌۭ مِّنْ عَمَلِ ٱلشَّيْطَٰنِ فَٱجْتَنِبُوهُ لَعَلَّكُمْ تُفْلِحُونَ ﴿٩٠﴾
O you who have believed, indeed, intoxicants, gambling, [sacrificing on] stone alters [to other than Allah], and divining arrows are but defilement from the work of Satan, so avoid it that you may be successful.
Gambling is forbidden whatever the outcome.
Quran, Surah Al-Baqara 2:188
وَلَا تَأْكُلُوٓا۟ أَمْوَٰلَكُم بَيْنَكُم بِٱلْبَٰطِلِ وَتُدْلُوا۟ بِهَآ إِلَى ٱلْحُكَّامِ لِتَأْكُلُوا۟ فَرِيقًۭا مِّنْ أَمْوَٰلِ ٱلنَّاسِ بِٱلْإِثْمِ وَأَنتُمْ تَعْلَمُونَ ﴿١٨٨﴾
And do not consume one another's wealth unjustly or send it [in bribery] to the rulers in order that [they might aid] you [to] consume a portion of the wealth of the people in sin, while you know [it is unlawful].
Winnings are another person's wealth taken without right.
Sahih Muslim 1015
Sahih... إن الله طيب لا يقبل إلا طيبا ...
"Allah is pure and accepts only what is pure."
Gambling money cannot be offered as charity for reward.
Sahih al-Bukhari 4860
Sahih... ومن قال لصاحبه تعال أقامرك فليتصدق ...
"Whoever says to his companion, Come, let me gamble with you, let him give charity."
Even the invitation to gamble needs expiation.
Where the ruling is recorded
- Radd al-Muhtar (Ibn Abidin), Kitab al-Hazr wa al-Ibaha, on qimar; and Kitab al-Buyu', on unlawfully gained wealth. Wealth taken unlawfully is returned to its owner, or given in charity when the owner cannot be found.
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.