In the ITER neutral beam injectors (NBI), the presence of an external variable magnetic field generated by the ITER tokamak itself, could deflect the ion beam during acceleration and cause a loss of beam focusing. For this reason, the ion source, the accelerator and the neutralizer will be shielded from external magnetic field by means of a passive magnetic shield and a system of active correction and compensation coils (ACCC). The ACCC will operate in a feedback control loop and thus require the measurement of magnetic field inside the NBI vessel. Magnetic sensors for this application must be capable of measuring DC and slow variable magnetic fields, and be vacuum-compatible, radiation-hard and robust, since they will be subjected to neutron flux produced by fusion reactions in the tokamak and inaccessible for maintenance. This paper describes the realization and tests of fluxgate magnetic sensors prototypes specifically designed for this purpose before the installation in MITICA and ITER.