There are six obligatory fast days. One is biblically mandated, four were established by the later prophets (Chaggai, Zechariah and Malachi), and one is merely a widely accepted custom.
The biblically mandated one is Yom Kippur. The Torah tells us: (Vayikra 16:29)
וְהָיְתָה לָכֶם, לְחֻקַּת עוֹלָם: בַּחֹדֶשׁ הַשְּׁבִיעִי בֶּעָשׂוֹר לַחֹדֶשׁ תְּעַנּוּ אֶת-נַפְשֹׁתֵיכֶם, וְכָל-מְלָאכָה לֹא תַעֲשׂוּ–הָאֶזְרָח, וְהַגֵּר הַגָּר בְּתוֹכְכֶם.
“On the 10th day of the 7th month you shall afflict your souls…”
Then we have the four fast days from the prophets. They are: Tzom Gedalyah, Asarah B’Teves, Shiva Asar B’Tammuz and Tisha B’Av. These are most famously alluded to in Zechariah (Chap. 8:19):
כֹּה-אָמַר יְהוָה צְבָאוֹת, צוֹם הָרְבִיעִי וְצוֹם הַחֲמִישִׁי וְצוֹם הַשְּׁבִיעִי וְצוֹם הָעֲשִׂירִי יִהְיֶה לְבֵית-יְהוּדָה לְשָׂשׂוֹן וּלְשִׂמְחָה, וּלְמֹעֲדִים, טוֹבִים; וְהָאֱמֶת וְהַשָּׁלוֹם, אֱהָבוּ
In this verse, Zechariah tells us that the “fast of the fourth month (Tammuz), the fast of the fifth month (Av) the seventh month (Tzom Gedalyah) and the tenth month (Asarah B’Teves)” will become days of joyousness and Moadim Tovim.
Taanis Esther, the Fast of Esther, was accepted by all of Israel and is therefore binding as law.
On Yom Kippur we don’t just fast, we have several “afflictions”. Eating and drinking, washing and anointing (putting on lotions or creams etc.), wearing leather shoes, and having marital relations are all prohibited. Additionally, Yom Kippur starts from the night prior, making it a 25 hour fast. All these halachos were adapted to Tisha B’Av as well.
The other fasts start from dawn (72 minutes before sunrise) and finish at nightfall (50 minutes after sunset) of that day. Only eating and drinking is prohibited. If however one went to sleep without verbalizing his intention to wake up before dawn to eat, and then happened to wake up early and wants to grab a bite before the fast begins, he has a problem, because he accepted the fast upon himself when he went to sleep. If he regularly takes a drink upon awakening, and wakes up before dawn, he may take a drink, even if he failed to verbalize his intentions before he went to sleep, but he may not eat. If he’s unusually thirsty, then he may take a drink even if he does not regularly do so, but eating will still be forbidden. (MB 564).
Even if one does verbalize his intention to eat upon awakening, he must begin eating a half hour prior to dawn.
We find that the Ramban, as quoted by the Vilna Gaon, explains that all the fast days originally should have had the severity of Tisha B’Av, but the people weren’t able to withstand them, so when the decrees against the Jewish People relaxed, the fast days were relaxed as well. However when it is a time of oppression for the Jewish People they would come back full force, and all the fast days would have the stringencies of Tisha B’Av. The Mishna Berurah quotes some Poskim that because we don’t know what is considered a time of oppression a Ba’al Nefesh should accept upon himself the stringencies of Tisha B’Av for all the other fasts as well, including starting at night, (aside for not wearing shoes because it will cause people to laugh at him).
The Aruch Hashulchan and others recommend not bathing or showering in hot water on a fast day. Additionally, the Biur Halacha (OC 551:2) suggests that perhaps the 17th of Tammuz and the 10th of Teves should have the severity of the Nine Days between Rosh Chodesh Av and Tisha B’Av, in addition to not eating.
The widely accepted custom is to refrain only from eating and drinking and to permit everything else (except for on Tisha B’Av and Yom Kippur).
It behooves us to consider that the primary purpose of the Rabbinical fast days is to inspire us to recall the tragic events that had occurred in our nations history on those days, and to rectify our own actions to ensure that we don’t repeat the mistakes of our ancestors. Then we will indeed merit the fulfillment of the prophecy of Zechariah, that all the days of mourning will be transformed to days of rejoicing.