We review the numerical techniques for ideal and non-ideal magneto-hydrodynamics (MHD) used in the context of star formation simulations. We outline the specific challenges offered by modeling star forming environments, which are dominated by supersonic and super-Alfvenic turbulence in a radiative, self-gravitating fluid. These conditions are rather unique in physics and engineering and pose particularly severe restrictions on the robustness and accuracy of numerical codes. One striking aspect is the formation of collapsing fluid elements leading to the formation of singularities that represent point-like objects, namely the proto-stars. Although a few studies have attempted to resolve the formation of the first and second Larson cores, resolution limitations force us to use sink particle techniques, with sub-grid models to compute the accretion rates of mass, momentum and energy, as well as their ejection rate due to radiation and jets from the proto-stars. We discuss the most popular discretisation techniques used in the community, namely smoothed particle hydrodynamics, finite difference and finite volume methods, stressing the importance to maintain a divergence-free magnetic field. We discuss how to estimate the truncation error of a given numerical scheme, and its importance in setting the magnitude of the numerical diffusion. This can have a strong impact on the outcome of these MHD simulations, where both viscosity and resistivity are implemented at the grid scale. We then present various numerical techniques to model non-ideal MHD effects, such as Ohmic and ambipolar diffusion, as well as the Hall effect. These important physical ingredients are posing strong challenges in term of resolution and time stepping. For the latter, several strategies are discussed to overcome the limitations due to prohibitively small time steps (abridged).