The electronic band structures and optical gains of InAs1-xNx/GaAs pyramid quantum dots (QDs) are calculated using the ten-band k∙p model and the valence force field method. The optical gains are calculated using the zero-dimensional optical gain formula with taking into consideration of both homogeneous and inhomogeneous broadenings due to the size fluctuation of quantum dots which follows a normal distribution. With the variation of QD sizes and nitrogen composition, it can be shown that the nitrogen composition and the strains can significantly affect the energy levels especially the conduction band which has repulsion interaction with nitrogen resonant state due to the band anticrossing interaction. It facilitates to achieve emission of longer wavelength (1.33 or 1.55μm) lasers for optical fiber communication system. For QD with higher nitrogen composition, it has longer emission wavelength and less detrimental effect of higher excited state transition, but nitrogen composition can affect the maximum gain depending on the factors of transition matrix element and the Fermi–Dirac distributions for electrons in the conduction bands and holes in the valence bands respectively. For larger QD, its maximum optical gain is greater at lower carrier density, but it is slowly surpassed by smaller QD as carrier concentration increases. Larger QD can reach its saturation gain faster, but this saturation gain is smaller than that of smaller QD. So the trade-off between longer wavelength, maximum optical, saturation gain, and differential gain must be considered to select the appropriate QD size according to the specific application requirement.