Short answer
A fast is rewarded when it is done for Allah. If your main aim in a voluntary fast is to please Allah, hoping for better health as well does not cancel the reward. A diet done only to lose weight is permitted but is not worship. Intermittent fasting that allows water or coffee during the day is not an Islamic fast at all.
A shar'i fast is holding back from food, drink and intercourse from true dawn to sunset with the intention of fasting for Allah. A voluntary fast intended for Allah, with health as a secondary hope, is valid and rewarded. Ramadan is fard regardless of any other benefit.
The four schools agree on this.
Explanation
The Prophet ﷺ said that deeds are only by intentions, and each person gets what they intended. So the same day without food can be worship or a diet, depending on why you do it.
Three cases:
- For Allah, with health in mind too. You fast Mondays and Thursdays as a sunnah and are glad it helps your weight. This is rewarded. Islam itself mentions worldly benefits of fasting: the Prophet ﷺ told young men who could not marry to fast because it curbs desire. A secondary benefit does not spoil a sincere intention.
- Only for weight loss. A diet is permitted, and caring for your body is good, but it is not an act of worship and earns no fasting reward.
- Mainly to be seen as pious: this is showing off and loses the reward.
Intermittent fasting. Plans like 16:8 usually allow water, black coffee or tea during the fasting window, and count hours from the last meal rather than from dawn. That is not a fast in the Islamic sense. You can, however, turn it into worship: eat suhoor before dawn, intend a sunnah fast for Allah, hold back from everything until Maghrib, and break it at sunset. That is a real fast, and it also fits many eating plans.
- Ramadan fasts are obligatory, whatever their health effect.
- Do not let a diet harm your health or lead you to skip meals in a way your doctor advises against.
- Fasting every day without a break is disliked. See the fast of Dawud.
See the sunnah fasts, why Muslims fast and hadith about intention.
The evidence
Quran, Surah Al-Baqara 2:183
يَٰٓأَيُّهَا ٱلَّذِينَ ءَامَنُوا۟ كُتِبَ عَلَيْكُمُ ٱلصِّيَامُ كَمَا كُتِبَ عَلَى ٱلَّذِينَ مِن قَبْلِكُمْ لَعَلَّكُمْ تَتَّقُونَ ﴿١٨٣﴾
O you who have believed, decreed upon you is fasting as it was decreed upon those before you that you may become righteous -
The purpose of fasting is taqwa, not only physical benefit.
Sahih al-Bukhari 1
Sahih... إنما الأعمال بالنيات وإنما لكل امرئ ما نوى ...
"Deeds are only by intentions, and each person will have what he intended."
The reward of a fast depends on why you keep it.
Sahih al-Bukhari 1905
Sahih... ومن لم يستطع فعليه بالصوم فإنه له وجاء ...
"Whoever is not able to marry should fast, for it is a restraint for him."
Fasting can be kept partly for a lawful worldly benefit while remaining worship.
Where the ruling is recorded
- al-Hidaya, Kitab al-Sawm, opening section. Fasting is abstaining from eating, drinking and intercourse by day with intention.
- Radd al-Muhtar (Ibn Abidin), Kitab al-Taharah, discussion of intention. Joining a permitted worldly aim to an act of worship does not cancel its reward when the worship is the main aim.
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.