Allah instructs in the Qur’an: “And they are ordained nothing else than to serve Allah, keeping religion pure for Him.” The Prophet, upon whom be peace, said: “Actions are judged according to the intention behind them, and for everyone is what he intended.”
The intention must be made before fajr and during every night of Ramadan. This point is based on the hadith of Hafsah which reported that the Prophet said: “Whoever does not determine to fast before fajr will have no fast” (that is, it won’t be accepted). This is related by Ahmad, an-Nasa’i, at-Tirmizhi, Abu Dawud, and Ibn Majah. Ibn Khuzaimah and Ibn Hibban have classified it as sahih.
The intention is valid during any part of the night. It need not be spoken, as it is in reality an act of the heart which does not involve the tongue. It will be fulfilled by one’s intention to fast out of obedience to Allah and for seeking His pleasure.
If one eats one’s pre-dawn meal (sahoor) with the intention of fasting and to get closer to Allah by such abstinence, then one has performed the intention. If one determines that one will fast on the next day solely for the sake of Allah, then one has performed the intention even if a pre-dawn meal was not consumed.
According to many of the jurists, the intention for a voluntary fast may be made at any time before any food is consumed. This opinion is based on ‘Aishah’s hadith: “The Prophet came to us one day and said: ‘Do you have any [food]?’ We said, ‘No.’ He said: ‘Therefore, I am fasting.” This is related by Muslim and Abu Dawud.
The Hanafiyyah and Shaf’iyyah stipulate that the intention must be made before noon (for voluntary fasts). The apparent opinion of Ibn Mas’ud and Ahmad is that the intention may be made before or after noon.