Satan got me again, and I masturbated during Ramadan. It was at night, after Iftar. Does the fast still count? If not, do I need to do it again? If yes, when? How do I repent for this act?
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Masturbation is forbidden in Ramadan and at all other times, but it is worse in Ramadan. It invalidates one's fasting in Ramadan if it happens during the day and necessitates making up the day, but not if it happens at night. However, such a misdeed requires repentance and true determination that one will not repeat it. One has also to avoid the causes of this misdeed, such as looking at women, pictures of women, or listening to what arouses lusts. Moreover, one has to avoid a bad company and should engage in what benefits him in this worldly life and the Hereafter. Besides, one should think about the bad consequences of this deed and Allah's punishment. Then, one should pray to Allah to keep him safe in body and religion and to grant him success to repent and do righteous deeds.
Allah knows best.
You can search for fatwa through many choices