This paper investigates the dynamic response of shallow foundations on linear and nonlinear soil medium using finite element method. The study was motivated by the need to develop macroscopic foundation models that can realistically capture the nonlinear behavior and energy dissipation mechanism of shallow foundations. An infinitely long strip foundation resting on soil half-space is analyzed in depth to evaluate the dependence of its dynamic responses on various parameters, e.g. foundation width, material properties, input motion amplitude and frequency etc. Special attentions are paid to choose appropriate domain scale, mesh size and boundary conditions so as to minimize the often observed numerical oscillations when the outgoing waves are contaminated by the reflecting waves at boundaries. Such judicious choice results in an excellent agreement between the finite element analysis and the analytical solution of strip foundation on linear soil half-space. Closed-form formulas are developed to describe the frequency-dependent linear dynamic stiffness of strip foundation along both horizontal and vertical directions. Various nonlinear constitutive models of soil, which exhibit the yielding and kinematic hardening behavior of soil, are implemented in this study to evaluate the dynamic stiffness of strip foundation sitting on nonlinear soil medium. The finite element analyses reveal the strong dependency of response on input motion amplitude, frequency and yielding of soil. A nonlinearity indicator is developed to incorporate the combined effects of initial elastic stiffness, yielding stress and excitation amplitude. The numerical analyses presented here provide improved understanding on the nonlinear behavior and energy dissipation mechanism of shallow foundations under dynamic loads.