Short answer
Not as a Ramadan fast. The Prophet ﷺ told us not to go ahead of Ramadan by fasting a day or two before it, unless it is a fast you already keep, such as your usual Monday. In the Hanafi school a purely voluntary fast on the day of doubt is allowed, but fasting it as Ramadan, just in case, is makruh tahrimi.
On the 30th of Sha'ban when the moon was hidden by cloud (yawm al-shakk, the day of doubt), fasting with the intention of Ramadan is makruh tahrimi, and with the intention of another obligatory fast is makruh tanzihi. A purely voluntary fast is not disliked, especially if it matches a fast you regularly keep. If that day turns out to be Ramadan, the fast counts for Ramadan.
Other madhhabs
- Shafi'i
- Fasting the day of doubt is haram unless it matches a regular habit or is a make-up or vowed fast. Fasting in the second half of Sha'ban is also prohibited unless joined to the first half or a habit.
- Maliki
- Fasting the day of doubt as a precaution for Ramadan is disliked; a voluntary or habitual fast on it is allowed.
- Hanbali
- In the relied-upon view, if cloud or haze hid the moon on the night of the 30th, fasting the next day with the intention of Ramadan is required as a precaution.
Explanation
Fasting in Sha'ban is a sunnah: Aishah said she never saw the Prophet ﷺ fast more in any month, besides Ramadan, than in Sha'ban. What is discouraged is starting Ramadan early on your own to be safe. He said: let none of you go ahead of Ramadan by fasting a day or two, unless a man has a fast he usually keeps, then let him fast that day.
The day of doubt. When the new moon is not seen on the evening of the 29th of Sha'ban because of cloud or haze, the next day is the day of doubt. Sha'ban is then counted as 30 days and Ramadan starts after it. The Companion Ammar ibn Yasir said that whoever fasts this day has disobeyed Abul Qasim ﷺ.
The Hanafi details:
- Fasting it as Ramadan, just in case: makruh tahrimi.
- Fasting it as a make-up or vowed fast: makruh tanzihi.
- Fasting it as a plain voluntary fast: allowed, and better if it falls on your usual Monday, Thursday or regular fast. The classical texts advise ordinary people to hold off eating until late morning in case news of the moon arrives, then eat if none comes.
If you fasted and the day is then confirmed as the first of Ramadan, your fast counts for Ramadan. Outside the last day or two, you may fast in Sha'ban as much as you like, and the Hanafi school does not dislike fasting in its second half. Making up last year's missed fasts in Sha'ban is a good use of these weeks: see when to make up missed fasts.
The evidence
Quran, Surah Al-Baqara 2:185
شَهْرُ رَمَضَانَ ٱلَّذِىٓ أُنزِلَ فِيهِ ٱلْقُرْءَانُ هُدًۭى لِّلنَّاسِ وَبَيِّنَٰتٍۢ مِّنَ ٱلْهُدَىٰ وَٱلْفُرْقَانِ ۚ فَمَن شَهِدَ مِنكُمُ ٱلشَّهْرَ فَلْيَصُمْهُ ۖ وَمَن كَانَ مَرِيضًا أَوْ عَلَىٰ سَفَرٍۢ فَعِدَّةٌۭ مِّنْ أَيَّامٍ أُخَرَ ۗ يُرِيدُ ٱللَّهُ بِكُمُ ٱلْيُسْرَ وَلَا يُرِيدُ بِكُمُ ٱلْعُسْرَ وَلِتُكْمِلُوا۟ ٱلْعِدَّةَ وَلِتُكَبِّرُوا۟ ٱللَّهَ عَلَىٰ مَا هَدَىٰكُمْ وَلَعَلَّكُمْ تَشْكُرُونَ ﴿١٨٥﴾
The month of Ramadhan [is that] in which was revealed the Qur'an, a guidance for the people and clear proofs of guidance and criterion. So whoever sights [the new moon of] the month, let him fast it; and whoever is ill or on a journey - then an equal number of other days. Allah intends for you ease and does not intend for you hardship and [wants] for you to complete the period and to glorify Allah for that [to] which He has guided you; and perhaps you will be grateful.
Ramadan begins with the confirmed moon, not with fasting early as a precaution.
Sahih al-Bukhari 1914
Sahih... لا يتقدمن أحدكم رمضان بصوم يوم أو يومين ...
"Let none of you go ahead of Ramadan by fasting a day or two."
Fasting a day or two before Ramadan, unless it is your habit, is discouraged.
Sunan Abi Dawud 2334
Grading to be checked... من صام هذا اليوم فقد عصى أبا القاسم ...
"Whoever fasts this day has disobeyed Abul Qasim."
The Companion Ammar's words about the day of doubt.
Sahih al-Bukhari 1969
Sahih... وما رأيته أكثر صياما منه في شعبان ...
"I never saw him fast more in any month than in Sha'ban."
Voluntary fasting in Sha'ban is a sunnah.
Where the ruling is recorded
- al-Hidaya, Kitab al-Sawm, chapter on sighting the new moon. The day of doubt is not fasted except as a voluntary fast.
- Radd al-Muhtar (Ibn Abidin), Kitab al-Sawm, chapter on sighting the new moon. The detail of intentions on the day of doubt and which are makruh tahrimi or tanzihi.
- Kashshaf al-Qina', Kitab al-Siyam. The Hanbali ruling that the 30th night obscured by cloud is followed by a precautionary fast.
- Minhaj al-Talibin, Kitab al-Siyam. The Shafi'i prohibition of the day of doubt and of fasting after mid-Sha'ban without a reason.
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.