A magnetoresistive element includes a first ferromagnetic layer formed on a base substrate, a tunnel barrier layer formed on the first ferromagnetic layer, and a second ferromagnetic layer containing B formed on the tunnel barrier layer. The second ferromagnetic layer includes at least one of H, F, Cl, Br, I, C, O, and N, and a concentration of molecules of the at least one of H, F, Cl, Br, I, C, O, and N included in the second ferromagnetic layer is higher in a central portion in a depth direction of the second ferromagnetic layer than in an upper surface and a lower surface thereof.