In the vibration of pile foundation, the nonlinearity of the stiffness and subsidence ratio of the soil around the pile is very significant; however, the current analysis method generally assume soil parameters are constant. In this paper, a new nonlinear calculation method for single pile and group pile under lateral load is proposed and programmed, based on the study method of horizontal vibration of partial embedded piles under distributed load, and according to the correlation between the internal force-displacement and the soil parameters of the pile. This program method can not only simulate the nonlinear behavior of soil, but also simulate the nonlinear structural response of pile under lateral load. In addition, the correctness of this method was verified by comparing with the results of previous experiments and the solutions under linear conditions. The effects of embedding ratio, pile spacing, and vibration frequency on the impedance of single pile and pile group and the interaction factor of pile and pile were analyzed more accurately under nonlinear conditions.