We investigate the magnetohydrodynamic (MHD) instability of the magnetic loop in association with the solar flare. We use \u27safety factor\u27 q to describe the local twist of the magnetic loop where low q value means the strong twist, then it becomes more unstable for the MHD instability.We present the q profile on the equilibrium for two types which may correspond to small and large flare. One type corresponding to small flare is the slim cylindrical untwisted magnetic loop in initial stage. When the tube is twisted, low q region is localized around the axis of the center of the loop. We conclude that the localized low q region must be ring shaped. The energy release by MHD instability can be localized with the ring shaped region. The other type is barrel shaped untwisted magnetic loop which may correspond to the large flare. After the twist, low q region is wide along the axis. The MHD instability is caused on the whole magnetic loop, therefore the energy release is global