The breaking up of gas filament in liquid is important in many industrial and scientific applications. In this study, a transient axisymmetric model with the level set method is built up to examine the dynamics of a contracting gas filament, and to determine the effects of the aspect ratio, Ohnesorge (Oh) number, and viscosity ratio on its breakup mode. The filament undergoes no break, middle break, or end-pinching modes with increasing aspect ratio at either a low or a high Oh number, and one critical initial aspect ratio is observed for each Oh number.The fate of the filament is determined by the interaction of capillary waves on its surface, and can be predicted accurately by using the one-dimensional wave superposition method. The decreasing viscosity ratio of liquid over gas reduces the critical initial aspect ratio for the fate transition between the no break and breakup modes, and this effect is reduced at a low viscosity ratio. These findings may be helpful in fabricating gas bubbles and their breakup suppression.