The perpendicular magnetic anisotropy (PMA) of Fe1−xCox thin films on MgO(001) was investigated via first-principles density-functional calculations. Four different configurations were considered based on their ground states: Fe/MgO, Fe12Co4/MgO, Fe10Co6/MgO, and Fe8Co8/MgO. As the Co composition increases, the amplitude of PMA increases first from Fe/MgO to Fe12Co4/MgO, and then decreases in Fe10Co6/MgO; finally, the magnetic anisotropy becomes horizontal in Fe8Co8/MgO. Analysis based on the second-order perturbation of the spin-orbit interaction was carried out to illustrate the contributions from Fe and Co atoms to PMA, and the differential charge density was calculated to give an intuitive comparison of 3d orbital occupancy. The enhanced PMA in Fe12Co4/MgO is ascribed to the optimized combination of occupied and unoccupied 3d states around the Fermi energy from both interface Fe and Co atoms, while the weaker PMA in Fe10Co6/MgO is mainly attributed to the modulation of the interface Co-dxy orbital around the Fermi energy. By adjusting the Co composition in Fe1−xCox, the density of states of transitional metal atoms will be modulated to optimize PMA for future high-density memory application.