First of all, it is necessary to know that making up the missed days of Ramadan is obligatory, while fasting the six days in Shawwal is Sunnah (recommended). Scholars differed regarding the permissibility of the voluntary fasting prior to making up the missed days in Ramadan. There are two opinions on this issue:
First: It is acceptable to fast the voluntary days before making up the missed days of Ramadan. This is the view of the majority of scholars; some allowed it absolutely while others disliked it. According to the Hanafi scholars and a view of Ahmad, doing the voluntary fasting before making up the missed days in Ramadan is permissible because making up the missed days is not required immediately. The author of Tuhfat al-Muhtaj fi sharh al-Minhaj state that a person who misses some days in Ramadan “has to make up these days immediately. However, some previous scholars said that it is disliked for this person to fast the six days during Shawwal if s/he has to make up any missed days of Ramadan. On the other hand, the Maliki and Shafiʻi scholars maintain that it is permissible but disliked, for its results in delaying the obligatory fasting. They argue that the time of making up is wide while the time of the voluntary fasting here is limited. In addition, the act of making up is not to be done immediately and could be delayed.
Second: The Hanbali scholars maintain that it is forbidden to fast the voluntary fasting prior to making up the obligatory fasting. As such, it is forbidden in their view to fast the six days during Shawwal before fasting the missed fasting in Ramadan. However, according to another view of Imam Ahmed, it is permissible to fast the voluntary fasting before making up the missed days of the obligatory fasting.
The most accepted opinion, especially that of the majority of scholars, is that the days of Shawwal are limited and a person who fears lest they end before fasting the six days may fast them before making up the days of Ramadan, for there are too many days to make up the missed days after Shawwal.
The practice of the Companions affirms this view. It is narrated that ʻA’ishah, the Mother of the Believers, said I had to complete some of the fasts of Ramadan, but I could not do it but during the month of Shaʻban due to my being occupied by taking care of the Messenger of Allah. However, it is better to make up the missed days as soon as possible and do them before voluntary fasting. Only if a person fears lest the month should end before doing the fixed voluntary fasting of Shawwal, one may do the voluntary fasting before the obligatory one.
Allah knows best.