The fast of Ramadan, according to the Qur’an, sunnah and consensus, is obligatory.
The evidence from the Qur’an consists of the following two verses: “O you who believe, fasting is prescribed for you as it was prescribed for the people before you in order for you to gain God consciousness, and, “…The month of Ramadan, during which the Qur’an was revealed, a guidance for mankind, and clear proofs of the guidance and the criterion; and whoever of you is resident, let him fast the month” [al-Baqarah 185].
From the sunnah we have the following statements of the Prophet: “Islam is built upon [the following] five pillars: testifying that there is no God except Allah and that Muhammad is His Messenger, the establishment of the prayer, the giving of zakah, the fast of Ramadan and the pilgrimage to Makkah.” Talhah ibn ‘Ubaidullah reported that a man came to the Prophet and said: “O Messenger of Allah, tell me what Allah requires of me as regards fasting.” He answered, “The month of Ramadan.” The man asked: “Is there any other [fast]?” The Prophet answered: “No, unless you do so voluntarily.”
The whole Muslim nation agrees that the fast of Ramadan is obligatory. It is one of the pillars of Islam, and if one disputes this, he cannot be called a Muslim.