In recent years tests on General Relativity have been made and numerical simulations played an important role, in particular Numerical Relativity (NR) simulations have been used in the understanding of astrophysics phenomena. Recent works have shown the importance of NR in the case of cosmology using cosmological perturbations for a flat expanding universe with a perfect fluid background without the presence of magnetic fields. The main interest of this work is to have an insight of cosmic magnetic fields under the cosmic dynamo equation. To achieve this, cosmological perturbations at first order are treated under a spatially flat Friedman-Lemaıitre-Robertson-Walker (FLRW) metric in order to obtain the cosmic dynamo equation. Finally, NR is used to write the perturbed Einstein field equations in the 3+1 formalism to be able to obtain the evolution equations for the magnetic field.