Does masturbation during fasting invalidates it? If it does so, what would be the compensation for it?
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.
If someone happens to masturbate, he should repent to Allah from this sin and give it up completely.
For more benefit, please refer to Fatwa 81167.
Now if someone masturbates during the daytime of Ramadan and ejaculates, his fasting of that day is invalidated. But he should refrain from all things that break the fast during that day to show respect to Islamic rites.
He should also make up for that day by fasting one day instead of it. But he does not have to expiate for that day.
Allah knows best.
You can search for fatwa through many choices