Short answer
Either. Ramadan, like every Hijri month, is 29 or 30 days, depending on when the new moon of Shawwal is seen. It is never 28 or 31. If it ends after 29 days, you do not need to fast a 30th day, and the Prophet ﷺ said the reward of Ramadan is not reduced. All four schools agree.
The month begins and ends with the sighting of the crescent, or with completing thirty days when the moon cannot be seen. A Ramadan of 29 days is complete, and nothing is owed for a 30th day.
The four schools agree on this.
Explanation
The Islamic calendar is lunar. Each month starts with the new crescent, and a lunar cycle is about 29 and a half days, so months alternate between 29 and 30 days. The Prophet ﷺ described the month with his hands: sometimes twenty-nine, sometimes thirty, saying that this community does not depend on writing and calculation to know it.
How the length is decided:
- On the evening of the 29th of Ramadan, people look for the Shawwal moon.
- If it is seen, or confirmed by the authority you follow, the next day is Eid and Ramadan was 29 days.
- If it is not seen, Ramadan is completed as 30 days, and Eid is the day after.
Is a 29-day Ramadan lesser? No. The Prophet ﷺ said the two months of Eid, Ramadan and Dhul Hijjah, are not lessened. The scholars explain that their reward is complete whether they are 29 or 30 days. So you have not missed anything, and no extra fast is owed.
- Fasting on Eid day is not allowed. See fasting on Eid.
- If travel left you with 28 or 31 fasts, see fasting 28 or 31 days.
- For why the dates move each year, see why Ramadan moves.
Different countries may end Ramadan on different days because of moon sighting methods, a question on which scholars sincerely differ. See the moon sighting calculator and the Ramadan countdown.
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.
The month is completed by its count, whether 29 or 30 days.
Sahih al-Bukhari 1907
Sahih... الشهر تسع وعشرون ليلة فلا تصوموا حتى تروه فإن غم عليكم فأكملوا العدة ثلاثين ...
"The month is twenty-nine nights, so do not fast until you see it, and if it is hidden from you, complete thirty."
A month is 29 days, or 30 when the moon is not seen.
Sahih al-Bukhari 1912
Sahih... شهران لا ينقصان شهرا عيد رمضان وذو الحجة ...
"Two months are not lessened, the two months of Eid: Ramadan and Dhul Hijjah."
A 29-day Ramadan carries its full reward.
Sahih al-Bukhari 1913
Sahih... إنا أمة أمية لا نكتب ولا نحسب الشهر هكذا وهكذا ...
"We are an unlettered community: we do not write or calculate. The month is like this and like this."
The month is known by sighting and is sometimes 29, sometimes 30.
Where the ruling is recorded
- al-Hidaya, Kitab al-Sawm, chapter on sighting the crescent. The month is established by sighting or by completing thirty days.
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.