In this paper, the nonlinear effects in three-level neutral-point-clamped inverters will be studied and a compensation algorithm, based on field oriented control (FOC) technique, will be proposed. In voltage source inverters (VSIs), nonlinear effects such as voltage drops on power semiconductors, and their turn on/turn off times cause distortions at the output voltage. Also dead-time, inserted in order to avoid short-circuits, are another source of nonlinearity. The proposed compensation algorithm is developed by analyzing the effects of nonlinearities in each switching period and correcting modulation signals with compensation signals accordingly. The algorithm is implemented in software and does not require any additional hardware. The proposed algorithm is verified by simulation results and experiments.