*Intention of fasting*
The Prophet (blessings and peace of Allah be upon him) said: “Whoever does not intend to fast before dawn, there is no fast for him.” Narrated by Abu Dawood (2454), at-Tirmidhi (730) and an-Nasaa’i (2331). According to a version narrated by an-Nasaa’i, “Whoever does not form the intention to fast from the night before, before dawn, there is no fast for him.” This hadith was classed as saheeh by al-Albaani in Saheeh Abi Dawood.
At-Tirmidhi (may Allah have mercy on him) said: What this means, according to some of the scholars, is that there is no fast for the one who did not form the intention to fast before the break of dawn in Ramadan, or when making up a missed Ramadan fast, or when fasting in fulfilment of a vow. If he did not intend to fast from the night before, then his fast is not valid. In the case of a voluntary fast, however, it is permissible for him to form the intention to fast after dawn has broken. This is the view of ash-Shaafa‘i, Ahmad and Ishaaq. End quote