We present a simulation environment, dForce, which can be used for a better understanding of dynamic force microscopy experiments. The simulator presents the cantilever-tip dynamics for two dynamic AFM methods, tapping mode AFM and bimodal AFM. It can be applied for a wide variety of experimental situations in air or liquid. The code provides all the variables and parameters relevant in those modes, for example, the instantaneous deflection and tip-surface force, velocity, virial, dissipated energy, sample deformation and peak force as a function of time or distance. The simulator includes a variety of interactions and contact mechanics models to describe AFM experiments including: van der Waals, Hertz, DMT, JKR, bottom effect cone correction, linear viscoelastic forces or the standard linear solid viscoelastic model. We have compared two numerical integration methods to select the one that offers optimal accuracy and speed. The graphical user interface has been designed to facilitate the navigation of nonexperts in simulations. Finally, the accuracy of dForce has been tested against numerical simulations performed during the last 18 years.